JDK-8146038 : CleanerImpl should not depend on ManagedLocalsThread
  • Type: Bug
  • Component: core-libs
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-12-22
  • Updated: 2016-01-07
  • Resolved: 2015-12-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b100Fixed
Related Reports
Relates :  
Relates :  
Description
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() ||