RFD: Replace class java.lang.Shutdown.Lock with Object?

Eirik Bjørsnøs eirbjo at gmail.com
Mon Jan 19 10:16:53 UTC 2026


David,

On Sun, Jan 18, 2026 at 11:04 PM David Holmes <david.holmes at oracle.com>
wrote:

> You would lose potentially important information when reporting monitors
> owned by a thread.


I get that the class name may be useful for diagnostic purposes.

However, the new Object() idiom has several thousand occurrences across the
JDK, while new Lock() revealed only these two (plus a few in tests).

These Lock classes seem like an easy win in the effort to trim the list of
JDK class loading during startup/shutdown.

Do you feel that the diagnostic value added by using named classes for
these two instances outweighs the benefit of trimming class loading during
startup?

Also I think Valhalla is trying to dissuade/move-away-from using "new
> Object()".


Hmm.. The alternative solution cannot be to introduce custom Lock classes
everywhere, right?

Thanks,
Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260119/676098c9/attachment.htm>


More information about the core-libs-dev mailing list