RFD: Replace class java.lang.Shutdown.Lock with Object?
Eirik Bjørsnøs
eirbjo at gmail.com
Tue Jan 27 06:28:02 UTC 2026
On Tue, Jan 27, 2026 at 12:05 AM Roger Riggs <roger.riggs at oracle.com> wrote:
> Hi,
>
> String is also an Identity class and its value could distinguish between
> the cases. (Both strings can be very short).
>
> About java.lang.Object as a lock, the pervasiveness of `new Object()` for
> locks resulted in giving it special dispensation in as a supertype of value
> objects. Trying to change its existing uses was determined to be infeasible.
>
Great minds are pulling this thread in interesting directions, which is
fine! I may go ahead file a PR to focus on the specific small changes
initially suggested. Then any broader discussions can continue here.
Was there ever any thoughts to add an API point for defining new montor
objects, such as Object.newLock() or perhaps even something like
Object.newLock(Class context, String tag)?
Perhaps this could:
a) Make the semantics/purpose of creating a new object more clear
b) Allow the JVM to return any object it wants
c) Allow monitor objects to be more informative
Cheers,
Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260127/2cdf459e/attachment-0001.htm>
More information about the core-libs-dev
mailing list