RFR: 8307535: java.util.logging.Handlers should be more VirtualThread friendly

Daniel Fuchs dfuchs at openjdk.org
Fri May 5 13:57:18 UTC 2023


On Fri, 5 May 2023 13:43:43 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> Several Handlers class use monitors to synchronize when formatting / publishing LogRecords.
> When logging within a VirtualThread, holding this monitor can cause the carrier thread to be pinned.
> Handlers could use jdk.internal.misc.InternalLock, in a similar way to some java.io classes (such as PrintStream) to avoid pinning the carrier thread.

Something I was wondering:

Use of InternalLock can be disabled with `-Djdk.io.useMonitors=true`

But should we have a property to force the use of InternalLock (when enabled) even in the presence of custom handlers subclasses? We could use `-Djdk.io.useMonitors=false` to mean that - or introduce a new system property specific to `java.util.logging.Handlers`. For instance `-Djdk.logging.disableMonitors=true`? That could be helpful for applications that do heavy logging and use their own custom handlers.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/13832#issuecomment-1536297097


More information about the core-libs-dev mailing list