A new lightweight locking mechanism for uncontended 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 this release, the `LockingMode` default has been changed to `LM_LIGHTWEIGHT`.
This is not expected to change any semantic behavior of Java monitor locking. It is expected to be performance neutral for almost all applications.
If you need to revert to the legacy mechanism, you can set the command-line flag `-XX:LockingMode=1`, but note that legacy mode is expected to be removed in a future release.