< prev index next >

src/java.management/share/classes/sun/management/ManagementFactoryHelper.java

Print this page
rev 58228 : 8238665: Add JFR event for direct memory statistics

*** 37,48 **** import javax.management.RuntimeOperationsException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; - import jdk.internal.access.JavaNioAccess; import jdk.internal.access.SharedSecrets; import java.util.ArrayList; import java.util.List; import java.lang.reflect.UndeclaredThrowableException; --- 37,49 ---- import javax.management.RuntimeOperationsException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import jdk.internal.access.SharedSecrets; + import jdk.internal.misc.VM; + import jdk.internal.misc.VM.BufferPool; import java.util.ArrayList; import java.util.List; import java.lang.reflect.UndeclaredThrowableException;
*** 338,365 **** } private static List<BufferPoolMXBean> bufferPools = null; public static synchronized List<BufferPoolMXBean> getBufferPoolMXBeans() { if (bufferPools == null) { ! bufferPools = new ArrayList<>(2); ! bufferPools.add(createBufferPoolMXBean(SharedSecrets.getJavaNioAccess() ! .getDirectBufferPool())); ! bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl ! .getMappedBufferPool())); ! bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl ! .getSyncMappedBufferPool())); } return bufferPools; } private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool"; /** * Creates management interface for the given buffer pool. */ private static BufferPoolMXBean ! createBufferPoolMXBean(final JavaNioAccess.BufferPool pool) { return new BufferPoolMXBean() { private volatile ObjectName objname; // created lazily @Override public ObjectName getObjectName() { --- 339,361 ---- } private static List<BufferPoolMXBean> bufferPools = null; public static synchronized List<BufferPoolMXBean> getBufferPoolMXBeans() { if (bufferPools == null) { ! bufferPools = new ArrayList<>(3); ! VM.getBufferPools().forEach(pool -> bufferPools.add(createBufferPoolMXBean(pool))); } return bufferPools; } private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool"; /** * Creates management interface for the given buffer pool. */ private static BufferPoolMXBean ! createBufferPoolMXBean(final BufferPool pool) { return new BufferPoolMXBean() { private volatile ObjectName objname; // created lazily @Override public ObjectName getObjectName() {
< prev index next >