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

CleanerImpl should not depend on ManagedLocalsThread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • b100

      With the addition of a Thread constructor that can suppress the inheriting
      of inheritable thread-local variable initial values from the constructing
      thread JDK-8056152, the usages of ManagedLocalsThread were removed
      from the base module. ManagedLocalsThread was also removed from the
      hierarchy of InnocuousThread, to help reduce dependencies. As a result
      InnocuousThread is no longer a ManagedLocalsThread, and the
      CleanerImpl should not use it in its instance of check.

      diff --git a/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java b/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java
      --- a/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java
      +++ b/src/java.base/share/classes/jdk/internal/misc/CleanerImpl.java
      @@ -39,7 +39,6 @@
      import java.util.function.Function;

      import sun.misc.InnocuousThread;
      -import sun.misc.ManagedLocalsThread;

      /**
       * CleanerImpl manages a set of object references and corresponding cleaning actions.
      @@ -130,8 +129,8 @@
           */
          public void run() {
              Thread t = Thread.currentThread();
      - ManagedLocalsThread mlThread = (t instanceof ManagedLocalsThread)
      - ? (ManagedLocalsThread) t
      + InnocuousThread mlThread = (t instanceof InnocuousThread)
      + ? (InnocuousThread) t
                      : null;
              while (!phantomCleanableList.isListEmpty() ||
                      !weakCleanableList.isListEmpty() ||

            chegar Chris Hegarty
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: