You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
invoke cleaner method to Clean throws IllegalArgumentException
repl-example
scala> val cleanerMethod = Class.forName("java.nio.DirectByteBuffer").getMethod("cleane
cleanerMethod: java.lang.reflect.Method = public sun.misc.Cleaner java.nio.DirectByteBu
scala> cleanerMethod.setAccessible(true)
scala> val cleanMethod = Class.forName("sun.misc.Cleaner").getMethod("clean")
cleanMethod: java.lang.reflect.Method = public void sun.misc.Cleaner.clean()
scala> cleanMethod.setAccessible(true)
scala> val bb = java.nio.ByteBuffer.allocateDirect(1000)
bb: java.nio.ByteBuffer = java.nio.DirectByteBuffer[pos=0 lim=1000 cap=1000]
scala> bb.isDirect
res2: Boolean = true
scala> val cleaner = cleanerMethod.invoke(bb)
cleaner: Object = sun.misc.Cleaner@79a7bfbc
scala> cleanerMethod.invoke(cleaner)
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
at java.lang.reflect.Method.invoke(Method.java:498)
... 32 elided
scala> cleanMethod.invoke(cleaner)
res4: Object = null
The text was updated successfully, but these errors were encountered:
johanandren
changed the title
DirectByteBufferPool calls DirectByteBuffer#clean twice i
DirectByteBufferPool calls DirectByteBuffer#clean twice
Oct 4, 2016
DirectByteBuffer#clean()
was called twice. (via reflection)https://github.com/openjdk-mirror/jdk7u-jdk/blob/jdk7u6-b08/src/share/classes/java/nio/Direct-X-Buffer.java.template#L103
Cleaner#clean
method was fetched but not called.https://github.com/openjdk-mirror/jdk7u-jdk/blob/jdk7u6-b08/src/share/classes/sun/misc/Cleaner.java#L138
invoke
cleaner
method toClean
throwsIllegalArgumentException
repl-example
The text was updated successfully, but these errors were encountered: