mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8207235: ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class) throws NPE
Reviewed-by: alanb
This commit is contained in:
parent
8afac1c9da
commit
173732afaa
3 changed files with 41 additions and 40 deletions
|
@ -26,6 +26,8 @@
|
|||
package java.nio;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import jdk.internal.misc.JavaNioAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.Unsafe;
|
||||
|
||||
import java.util.Spliterator;
|
||||
|
@ -707,4 +709,23 @@ public abstract class Buffer {
|
|||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
static {
|
||||
// setup access to this package in SharedSecrets
|
||||
SharedSecrets.setJavaNioAccess(
|
||||
new JavaNioAccess() {
|
||||
@Override
|
||||
public JavaNioAccess.BufferPool getDirectBufferPool() {
|
||||
return Bits.BUFFER_POOL;
|
||||
}
|
||||
@Override
|
||||
public ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob) {
|
||||
return new DirectByteBuffer(addr, cap, ob);
|
||||
}
|
||||
@Override
|
||||
public void truncate(Buffer buf) {
|
||||
buf.truncate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue