sun.misc.Cleaner has been moved to internal package jdk.internal.ref recently [1] to clean-up sun.misc namespace. But now that:
- we have comparable public API (java.lang.ref.Cleaner & Cleanable) [2]
- we have an internal shared java.lang.ref.Cleaner instance (jdk.internal.ref.CleanerFactory.cleaner())
- sun.misc.Cleaner is not a special kind of Reference any more in the JVM [3]
- threads failing to allocate memory in NIO themselves get involved in cleaning, seeJDK-6857566
...I think there's no reason to keep this special internal API any more. It can be replaced with public API.
I propose to remove jdk.internal.ref.Cleaner class and replace its usages with java.lang.ref.Cleaner and friends [4].
[1] https://bugs.openjdk.java.net/browse/JDK-8148117
[2] https://bugs.openjdk.java.net/browse/JDK-8138696
[3] https://bugs.openjdk.java.net/browse/JDK-8143847
[4] http://cr.openjdk.java.net/~plevart/jdk9-dev/removeInternalCleaner/webrev.03/
- we have comparable public API (java.lang.ref.Cleaner & Cleanable) [2]
- we have an internal shared java.lang.ref.Cleaner instance (jdk.internal.ref.CleanerFactory.cleaner())
- sun.misc.Cleaner is not a special kind of Reference any more in the JVM [3]
- threads failing to allocate memory in NIO themselves get involved in cleaning, see
...I think there's no reason to keep this special internal API any more. It can be replaced with public API.
I propose to remove jdk.internal.ref.Cleaner class and replace its usages with java.lang.ref.Cleaner and friends [4].
[1] https://bugs.openjdk.java.net/browse/JDK-8148117
[2] https://bugs.openjdk.java.net/browse/JDK-8138696
[3] https://bugs.openjdk.java.net/browse/JDK-8143847
[4] http://cr.openjdk.java.net/~plevart/jdk9-dev/removeInternalCleaner/webrev.03/
- relates to
-
JDK-8151571 InnocuousThread cannot be created during early startup
- Closed
-
JDK-8055232 (ref) Exceptions while processing Reference pending list
- Resolved
-
JDK-8151797 java/lang/management/ThreadMXBean/ThreadLists.java : inconsistent results
- Closed