On Fri, 5 May 2023 13:43:43 GMT, Daniel Fuchs <dfu...@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.

I'm just an author, not a reviewer, but I'm also the creator of the 
`jboss-logmanager` project, which is based heavily on subclassing many of the 
`java.util.logging` APIs.

One thing I noticed is that the setters for filter/formatter/level etc. still 
use synchronized; I guess that user-based subclasses could still depend on 
this, and handlers which use the internal lock don't care. But if this is the 
case, then in the internal lock case, synchronization isn't actually needed at 
all, so this could be tested for and optimized in this case. Otherwise it might 
be useful to leave a comment that explains the situation, since it's not 
obvious?

I didn't see anything else that looked like a red flag with this change so it's 
a non-binding +1 from me, for whatever it is worth, other than the above 
observation.

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

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

Reply via email to