< prev index next >
src/java.base/share/classes/jdk/internal/ref/CleanerFactory.java
Print this page
@@ -25,11 +25,10 @@
package jdk.internal.ref;
import jdk.internal.misc.InnocuousThread;
-import java.lang.ref.Cleaner;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.ThreadFactory;
/**
@@ -37,11 +36,12 @@
* The cleaner is created on the first reference to the CleanerFactory.
*/
public final class CleanerFactory {
/* The common Cleaner. */
- private final static Cleaner commonCleaner = Cleaner.create(new ThreadFactory() {
+ private final static ExtendedCleaner commonCleaner = ExtendedCleaner.create(
+ new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Thread run() {
@@ -49,20 +49,26 @@
t.setPriority(Thread.MAX_PRIORITY - 2);
return t;
}
});
}
- });
+ }
+ );
/**
- * Cleaner for use within system modules.
- *
- * This Cleaner will run on a thread whose context class loader
- * is {@code null}. The system cleaning action to perform in
+ * ExtendedCleaner for use within system modules.
+ * <p>
+ * This Cleaner's cleaning loop will run on a thread whose context
+ * class loader is {@code null}. The system cleaning action to perform in
* this Cleaner should handle a {@code null} context class loader.
+ * <p>
+ * This Cleaner is an {@link ExtendedCleaner} which supports helping
+ * the cleaner thread from arbitrary application threads. The system cleaning
+ * action to perform in this Cleaner should also handle being executed by
+ * arbitrary application thread.
*
- * @return a Cleaner for use within system modules
+ * @return an ExtendedCleaner for use within system modules
*/
- public static Cleaner cleaner() {
+ public static ExtendedCleaner cleaner() {
return commonCleaner;
}
}
< prev index next >