src/share/classes/java/lang/management/PlatformComponent.java

Print this page




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package java.lang.management;
  27 
  28 import java.util.ArrayList;
  29 import java.util.Collections;
  30 import java.util.List;
  31 import java.util.HashSet;
  32 import java.util.Set;
  33 import java.util.logging.LoggingMXBean;
  34 import java.util.logging.LogManager;
  35 import java.nio.BufferPoolMXBean;
  36 import javax.management.MBeanServerConnection;
  37 import javax.management.MalformedObjectNameException;
  38 import javax.management.ObjectName;
  39 
  40 import com.sun.management.HotSpotDiagnosticMXBean;
  41 import com.sun.management.UnixOperatingSystemMXBean;
  42 
  43 import sun.management.ManagementFactoryHelper;
  44 
  45 /**
  46  * This enum class defines the list of platform components
  47  * that provides monitoring and management support.
  48  * Each enum represents one MXBean interface. A MXBean
  49  * instance could implement one or more MXBean interfaces.
  50  *
  51  * For example, com.sun.management.GarbageCollectorMXBean
  52  * extends java.lang.management.GarbageCollectorMXBean
  53  * and there is one set of garbage collection MXBean instances,
  54  * each of which implements both c.s.m. and j.l.m. interfaces.
  55  * There are two separate enums GARBAGE_COLLECTOR
  56  * and SUN_GARBAGE_COLLECTOR so that ManagementFactory.getPlatformMXBeans(Class)
  57  * will return the list of MXBeans of the specified type.


 181      * Logging facility.
 182      */
 183     LOGGING(
 184         "java.util.logging.LoggingMXBean",
 185         "java.util.logging", "Logging", defaultKeyProperties(),
 186         new MXBeanFetcher<LoggingMXBean>() {
 187             public List<LoggingMXBean> getMXBeans() {
 188                 return Collections.singletonList(LogManager.getLoggingMXBean());
 189             }
 190         }),
 191 
 192 
 193     /**
 194      * Buffer pools.
 195      */
 196     BUFFER_POOL(
 197         "java.nio.BufferPoolMXBean",
 198         "java.nio", "BufferPool", keyProperties("name"),
 199         new MXBeanFetcher<BufferPoolMXBean>() {
 200             public List<BufferPoolMXBean> getMXBeans() {
 201                 List<BufferPoolMXBean> pools = new ArrayList<BufferPoolMXBean>(2);
 202                 pools.add( sun.misc.SharedSecrets.getJavaNioAccess().getDirectBufferPoolMXBean() );
 203                 pools.add( sun.nio.ch.FileChannelImpl.getMappedBufferPoolMXBean() );
 204                 return pools;
 205             }
 206         }),
 207 
 208 
 209     // Sun Platform Extension
 210 
 211     /**
 212      * Sun extension garbage collector that performs collections in cycles.
 213      */
 214     SUN_GARBAGE_COLLECTOR(
 215         "com.sun.management.GarbageCollectorMXBean",
 216         "java.lang", "GarbageCollector", keyProperties("name"),
 217         new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() {
 218             public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() {
 219                 return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class);
 220             }
 221         }),
 222 
 223     /**
 224      * Sun extension operating system on which the Java virtual machine




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any questions.
  24  */
  25 
  26 package java.lang.management;
  27 
  28 import java.util.ArrayList;
  29 import java.util.Collections;
  30 import java.util.List;
  31 import java.util.HashSet;
  32 import java.util.Set;
  33 import java.util.logging.LoggingMXBean;
  34 import java.util.logging.LogManager;
  35 import java.nio.BufferPoolMXBean;
  36 import javax.management.MBeanServerConnection;

  37 import javax.management.ObjectName;
  38 
  39 import com.sun.management.HotSpotDiagnosticMXBean;
  40 import com.sun.management.UnixOperatingSystemMXBean;
  41 
  42 import sun.management.ManagementFactoryHelper;
  43 
  44 /**
  45  * This enum class defines the list of platform components
  46  * that provides monitoring and management support.
  47  * Each enum represents one MXBean interface. A MXBean
  48  * instance could implement one or more MXBean interfaces.
  49  *
  50  * For example, com.sun.management.GarbageCollectorMXBean
  51  * extends java.lang.management.GarbageCollectorMXBean
  52  * and there is one set of garbage collection MXBean instances,
  53  * each of which implements both c.s.m. and j.l.m. interfaces.
  54  * There are two separate enums GARBAGE_COLLECTOR
  55  * and SUN_GARBAGE_COLLECTOR so that ManagementFactory.getPlatformMXBeans(Class)
  56  * will return the list of MXBeans of the specified type.


 180      * Logging facility.
 181      */
 182     LOGGING(
 183         "java.util.logging.LoggingMXBean",
 184         "java.util.logging", "Logging", defaultKeyProperties(),
 185         new MXBeanFetcher<LoggingMXBean>() {
 186             public List<LoggingMXBean> getMXBeans() {
 187                 return Collections.singletonList(LogManager.getLoggingMXBean());
 188             }
 189         }),
 190 
 191 
 192     /**
 193      * Buffer pools.
 194      */
 195     BUFFER_POOL(
 196         "java.nio.BufferPoolMXBean",
 197         "java.nio", "BufferPool", keyProperties("name"),
 198         new MXBeanFetcher<BufferPoolMXBean>() {
 199             public List<BufferPoolMXBean> getMXBeans() {
 200                 return ManagementFactoryHelper.getBufferPoolMXBeans();



 201             }
 202         }),
 203 
 204 
 205     // Sun Platform Extension
 206 
 207     /**
 208      * Sun extension garbage collector that performs collections in cycles.
 209      */
 210     SUN_GARBAGE_COLLECTOR(
 211         "com.sun.management.GarbageCollectorMXBean",
 212         "java.lang", "GarbageCollector", keyProperties("name"),
 213         new MXBeanFetcher<com.sun.management.GarbageCollectorMXBean>() {
 214             public List<com.sun.management.GarbageCollectorMXBean> getMXBeans() {
 215                 return getGcMXBeanList(com.sun.management.GarbageCollectorMXBean.class);
 216             }
 217         }),
 218 
 219     /**
 220      * Sun extension operating system on which the Java virtual machine