JDK-8331076 : Release Note: The `LockingMode` Flag, Along With The `LM_LEGACY` And `LM_MONITOR` Modes Are Deprecated
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2024-04-24
  • Updated: 2024-08-12
  • Resolved: 2024-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24Resolved
Description
A new lightweight locking mechanism for object monitor locking was introduced in JDK 21 under JDK-8291555. The `LockingMode` flag was introduced to allow selection of this new mechanism (`LM_LIGHTWEIGHT`, value 2) in place of the default mechanism (`LM_LEGACY`, value 1). In JDK 23, the `LockingMode` default was changed to `LM_LIGHTWEIGHT`.

In JDK 24, the `LockingMode` flag, along with the `LM_LEGACY` (1) and `LM_MONITOR` (0) modes are deprecated.  The default locking mode `LM_LIGHTWEIGHT` will be the only internal implementation that is supported when these locking modes become obsolete in a future release.

This is not expected to change any semantic behavior of Java monitor locking and it is expected to be performance neutral for almost all applications.
Comments
Thank you Dan and David.
12-08-2024

I'm good with it.
12-08-2024

Update looks good. Thanks.
01-08-2024

I take it to mean that the LM_LIGHTWEIGHT mechanism will remain as the only code present, and that "LM_LIGHTWEIGHT" itself will not exist as a name/flag anywhere in the code.
01-08-2024

We would remove the `LockingMode` option and just keep the code paths for LM_LIGHTWEIGHT, but LM_LIGHTWEIGHT would also disappear from the code. With the LockingMode command line argument removed, there's no way for a user to say or observe LM_LIGHTWEIGHT as a value anywhere. Sorry I didn't really know how to say this.
31-07-2024

This looks fine to me. The only question that I have is about this part: > The default locking mode `LM_LIGHTWEIGHT` will be the only internal > implementation that is supported when these locking modes become > obsolete in a future release. This sounds like locking mode `LM_LIGHTWEIGHT` will still exist when all the other locking modes are obsolete. Obsolete means removed right? So if we have no other locking mode values, then why would we keep locking mode `LM_LIGHTWEIGHT`? It would be the only one.
31-07-2024

> > The default locking mode `LM_LIGHTWEIGHT` will be the only internal implementation that is supported. > Is this meant to be a statement about 24, or is this the "in the future these other modes will be removed" statement? It's meant to mean when LM_LEGACY and LM_MONITOR are removed in JDK 26.
31-07-2024

I re-jigged the title and did some minor edits. > The default locking mode `LM_LIGHTWEIGHT` will be the only internal implementation that is supported. Is this meant to be a statement about 24, or is this the "in the future these other modes will be removed" statement?
30-07-2024

[~dcubed] This is an approximate copy of your release note to make LockingMode = LM_LIGHTWEIGHT the default. Please review.
08-07-2024