src/jdk.unsupported/share/classes/sun/misc/Unsafe.java
changeset 52427 3c6aa484536c
parent 52220 9c260a6b6471
--- a/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Tue Nov 06 17:28:14 2018 +0100
+++ b/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java	Tue Nov 06 10:01:16 2018 -0800
@@ -27,10 +27,8 @@
 
 import jdk.internal.vm.annotation.ForceInline;
 import jdk.internal.misc.VM;
-import jdk.internal.ref.Cleaner;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
-import sun.nio.ch.DirectBuffer;
 
 import java.lang.reflect.Field;
 import java.util.Set;
@@ -1234,13 +1232,6 @@
         if (!directBuffer.isDirect())
             throw new IllegalArgumentException("buffer is non-direct");
 
-        DirectBuffer db = (DirectBuffer)directBuffer;
-        if (db.attachment() != null)
-            throw new IllegalArgumentException("duplicate or slice");
-
-        Cleaner cleaner = db.cleaner();
-        if (cleaner != null) {
-            cleaner.clean();
-        }
+        theInternalUnsafe.invokeCleaner(directBuffer);
     }
 }