Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8284161 Implementation of Virtual Threads (Preview)
  3. JDK-8290003

Release Note: Thread Context ClassLoader Changed to be a Special Inheritable thread-local

XMLWordPrintable

      The thread context `ClassLoader` is specified in this release to be a special inheritable thread-local. This change should be transparent to existing code with the exception of code that uses the 5-arg `Thread` constructor (added in Java 9) to create a `Thread` that does not inherit the initial values of inheritable thread-locals from the constructing thread. With this release, invoking the 5-arg `Thread` constructor with the parameter `inheritInheritableThreadLocals` set to `false` will create a `Thread` that does not inherit the initial value of the context `ClassLoader` from the constructing thread. The `Thread.setContextClassLoader` method may be used to change the context `ClassLoader` of the new thread if needed.

      For further details, see the [JEP 425, section Thread-local variables](https://openjdk.java.net/jeps/425#Thread-local-variables).

            alanb Alan Bateman
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: