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

David Holmes david.holmes at oracle.com
Sun Jan 18 22:02:58 UTC 2026


On 17/01/2026 4:26 am, Eirik Bjørsnøs wrote:
> Hi,
> 
> java.lang.Shutdown uses a static nested Lock class for synchronization. 
> This seems trivially replaceable with new Object() which would reduce 
> class loading during shutdown.
> 
> java.lang.ref.ReferenceQueue uses a similar idiom and could potentially 
> be cleaned up as well.
> 
> I'd be happy to contribute a PR for this cleanup. Worth pursuing? Thoughts?

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

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

Cheers,
David
> Cheers,
> Eirik.



More information about the core-libs-dev mailing list