Summary
Obsolete the option to enable the legacy parallel class loading workaround in HotSpot for non-parallel-capable class loaders, and remove the JVM implementation of the workaround.
Problem
Prior to JDK 7, custom class loaders using non-hierarchical class delegation model were prone to deadlock (see [1] for details). A workaround was added in the VM in JDK 6 to allow parallel class loading for non-parallel-capable class loaders to avoid deadlocks. In addition, the VM also supports a common workaround at the time that some customers explicitly issue a wait() on the class loader lock.
Parallel-capable class loaders (CCC-4735126) are defined in Java SE 7 to support parallel class loading to implement a deadlock-free class loader using non-hierarchical class delegation model. [1] and [2] describe how to migrate those class loaders depending on this workaround to be multi-threaded parallel-capable class loaders. The workaround was intended to allow those customers to migrate to the new mechanism. It has been 11 years since JDK 7 and it's expected that those deadlock-prone custom class loaders should have migrated to the parallel-capable class loaders.
It is time to remove this workaround as it is an impediment to the project to eliminate the object monitors from pinning for virtual threads.
[1] https://openjdk.org/groups/core-libs/ClassLoaderProposal.html [2] https://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html
Solution
In JDK 20 an option -XX:+EnableWaitForParallelLoad was introduced be to enable this legacy workaround. This VM flag is obsolete and the legacy behavior is removed with this change. The -XX:+EnableWaitForParallelLoad option will produce a warning and will be ignored otherwise.
Specification
$ java -XX:+EnableWaitForParallelLoad -version
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option EnableWaitForParallelLoad; support was removed in 21.0
java version "21-internal" 2023-09-19 LTS
- csr of
-
JDK-8298469 Obsolete legacy parallel class loading workaround for non-parallel-capable class loaders
- Resolved