--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Wed Mar 09 13:37:30 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Wed Mar 09 21:17:06 2016 +0100
@@ -30,7 +30,7 @@
import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
-import jdk.internal.ref.Cleaner;
+import jdk.internal.ref.CleanerFactory;
/**
* The JVM interface for the method handles package is all here.
@@ -68,10 +68,12 @@
static CallSiteContext make(CallSite cs) {
final CallSiteContext newContext = new CallSiteContext();
- // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
- // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
- // referenced from Cleaner class) until cleanup is performed.
- Cleaner.create(cs, newContext);
+ // CallSite instance is tracked by a Cleanable which clears native
+ // structures allocated for CallSite context. Though the CallSite can
+ // become unreachable, its Context is retained by the Cleanable instance
+ // (which is referenced from Cleaner instance which is referenced from
+ // CleanerFactory class) until cleanup is performed.
+ CleanerFactory.cleaner().register(cs, newContext);
return newContext;
}