Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304056

Obsolete legacy parallel class loading workaround for non-parallel-capable class loaders

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • hotspot
    • None
    • behavioral
    • medium
    • Hide
      We provided an option to help customers migrate to parallel capable class loaders in JDK 20, and have provided release notes for helping customers understand if their code relies on this legacy behavior. This behavior is a corner case of class loading workaround that has been resolved a long time ago with parallel-capable class loading.
      JBOSS and WebLogic don't depend on the legacy behavior. In addition, Oracle posted a Quality Outreach notice https://inside.java/2022/11/14/quality-heads-up/ and no feedback so far.
      Show
      We provided an option to help customers migrate to parallel capable class loaders in JDK 20, and have provided release notes for helping customers understand if their code relies on this legacy behavior. This behavior is a corner case of class loading workaround that has been resolved a long time ago with parallel-capable class loading. JBOSS and WebLogic don't depend on the legacy behavior. In addition, Oracle posted a Quality Outreach notice https://inside.java/2022/11/14/quality-heads-up/ and no feedback so far.
    • add/remove/modify command line option
    • JDK

      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

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Mandy Chung
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: