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

Print this page

        

*** 25,48 **** package sun.management; import java.lang.management.*; - import javax.management.MBeanServer; - import javax.management.ObjectName; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; import javax.management.NotCompliantMBeanException; import javax.management.RuntimeOperationsException; - import java.nio.BufferPoolMXBean; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import sun.security.action.LoadLibraryAction; - import java.util.logging.PlatformLoggingMXBean; import sun.util.logging.LoggingSupport; import java.util.ArrayList; import java.util.Collections; import java.util.List; --- 25,46 ---- package sun.management; import java.lang.management.*; import javax.management.InstanceAlreadyExistsException; import javax.management.InstanceNotFoundException; + import javax.management.MBeanServer; import javax.management.MBeanRegistrationException; import javax.management.NotCompliantMBeanException; + import javax.management.ObjectName; import javax.management.RuntimeOperationsException; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import sun.security.action.LoadLibraryAction; import sun.util.logging.LoggingSupport; import java.util.ArrayList; import java.util.Collections; import java.util.List;
*** 137,157 **** } } return result; } ! public static List<PlatformLoggingMXBean> getLoggingMXBean() { if (LoggingSupport.isAvailable()) { ! return Collections.singletonList(createPlatformLoggingMXBean()); } else { ! return Collections.emptyList(); } } ! private final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; ! private static PlatformLoggingMXBean createPlatformLoggingMXBean() { ! return new PlatformLoggingMXBean() { private volatile ObjectName objname; // created lazily @Override public ObjectName getObjectName() { ObjectName result = objname; if (result == null) { --- 135,161 ---- } } return result; } ! public static PlatformLoggingMXBean getPlatformLoggingMXBean() { if (LoggingSupport.isAvailable()) { ! return PlatformLoggingImpl.instance; } else { ! return null; } } ! interface LoggingMXBean ! extends PlatformLoggingMXBean, java.util.logging.LoggingMXBean { ! } ! ! static class PlatformLoggingImpl implements LoggingMXBean ! { ! final static PlatformLoggingMXBean instance = new PlatformLoggingImpl(); ! final static String LOGGING_MXBEAN_NAME = "java.util.logging:type=Logging"; ! private volatile ObjectName objname; // created lazily @Override public ObjectName getObjectName() { ObjectName result = objname; if (result == null) {
*** 182,202 **** @Override public String getParentLoggerName(String loggerName) { return LoggingSupport.getParentLoggerName(loggerName); } - }; } ! public static List<BufferPoolMXBean> getBufferPoolMXBeans() { ! List<BufferPoolMXBean> pools = new ArrayList<BufferPoolMXBean>(2); ! pools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess() .getDirectBufferPool())); ! pools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl .getMappedBufferPool())); - return pools; } private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool"; /** * Creates management interface for the given buffer pool. --- 186,208 ---- @Override public String getParentLoggerName(String loggerName) { return LoggingSupport.getParentLoggerName(loggerName); } } ! private static List<BufferPoolMXBean> bufferPools = null; ! public static synchronized List<BufferPoolMXBean> getBufferPoolMXBeans() { ! if (bufferPools == null) { ! bufferPools = new ArrayList<>(2); ! bufferPools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess() .getDirectBufferPool())); ! bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl .getMappedBufferPool())); } + return bufferPools; + } private final static String BUFFER_POOL_MXBEAN_NAME = "java.nio:type=BufferPool"; /** * Creates management interface for the given buffer pool.