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

Alan Bateman alanb at openjdk.org
Thu May 11 07:30:41 UTC 2023


On Fri, 5 May 2023 18:38:28 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.
>
> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use locks consistently

src/java.logging/share/classes/java/util/logging/Handler.java line 88:

> 86:             return null;
> 87:         } else {
> 88:             return InternalLock.newLockOrNull();

I'm surprised to see InternalLock used here. That class was created for the java.io area to avoid surprises when a subclass uses a RL as the lock object. I assume it's just convenience to use it here, that is, I don't think the internal lock is exposed to subclasses in the j.u.logging API.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13832#discussion_r1190745991


More information about the core-libs-dev mailing list