java.lang.Objectjava.lang.management.ManagementFactory
ManagementFactory class is a factory class for getting managed beans for the Java platform.
This class consists of static methods each of which returns an instance or a list of all instances implementing the management interface of one component of the Java virtual machine. An instance implementing a management interface is a managed bean (MBean) conforming to the JMX instrumentation specification. An application can monitor the instrumentation of the Java virtual machine and manage certain characteristics in any of the following ways:
MBeanServer.MBean proxy and call the methods of the MBean proxy. The latter two methods require the MBean to be registered in an
MBeanServer. This class provides a static method
getPlatformMBeanServer() to return the platform MBeanServer
registered with all MBeans for the platform.
Each MBean has a unique ObjectName to register
in an MBeanServer.
A Java virtual machine has a single instance of the following management interfaces.
Management Interface ObjectName ClassLoadingMBean java.lang:type=ClassLoadingMemoryMBean java.lang:type=MemoryThreadMBean java.lang:type=ThreadingRuntimeMBean java.lang:type=RuntimeOperatingSystemMBean java.lang:type=OperatingSystem
A Java virtual machine has zero or a single instance of the following management interfaces.
Management Interface ObjectName CompilationMBean java.lang:type=Compilation
A Java virtual machine may have one or more instances of the following management interfaces.
Management Interface ObjectName GarbageCollectorMBean java.lang:type=GarbageCollector,name=collector's nameMemoryManagerMBean java.lang:type=MemoryManager,name=manager's nameMemoryPoolMBean java.lang:type=MemoryPool,name=pool's name
| Field Summary | |
|---|---|
static String |
CLASS_LOADING_MBEAN_NAME
String representation of the ObjectName for the ClassLoadingMBean. |
static String |
COMPILATION_MBEAN_NAME
String representation of the ObjectName for the CompilationMBean. |
static String |
GARBAGE_COLLECTOR_MBEAN_DOMAIN_TYPE
The domain name and the type key property in the ObjectName for a GarbageCollectorMBean. |
static String |
MEMORY_MANAGER_MBEAN_DOMAIN_TYPE
The domain name and the type key property in the ObjectName for a MemoryManagerMBean. |
static String |
MEMORY_MBEAN_NAME
String representation of the ObjectName for the MemoryMBean. |
static String |
MEMORY_POOL_MBEAN_DOMAIN_TYPE
The domain name and the type key property in the ObjectName for a MemoryPoolMBean. |
static String |
OPERATING_SYSTEM_MBEAN_NAME
String representation of the ObjectName for the OperatingSystemMBean. |
static String |
RUNTIME_MBEAN_NAME
String representation of the ObjectName for the RuntimeMBean. |
static String |
THREAD_MBEAN_NAME
String representation of the ObjectName for the ThreadMBean. |
| Method Summary | |
|---|---|
static ClassLoadingMBean |
getClassLoadingMBean()
Returns the managed bean for the class loading system of the Java virtual machine. |
static CompilationMBean |
getCompilationMBean()
Returns the managed bean for the compilation system of the Java virtual machine. |
static List |
getGarbageCollectorMBeans()
Returns a list of GarbageCollectorMBean objects
in the Java virtual machine. |
static List |
getMemoryManagerMBeans()
Returns a list of MemoryManagerMBean objects
in the Java virtual machine. |
static MemoryMBean |
getMemoryMBean()
Returns the managed bean for the memory system of the Java virtual machine. |
static List |
getMemoryPoolMBeans()
Returns a list of MemoryPoolMBean objects in the
Java virtual machine. |
static OperatingSystemMBean |
getOperatingSystemMBean()
Returns the managed bean for the operating system on which the Java virtual machine is running. |
static MBeanServer |
getPlatformMBeanServer()
Returns the platform MBeanServer. |
static RuntimeMBean |
getRuntimeMBean()
Returns the managed bean for the runtime system of the Java virtual machine. |
static ThreadMBean |
getThreadMBean()
Returns the managed bean for the thread system of the Java virtual machine. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CLASS_LOADING_MBEAN_NAME
ClassLoadingMBean.
public static final String COMPILATION_MBEAN_NAME
CompilationMBean.
public static final String MEMORY_MBEAN_NAME
MemoryMBean.
public static final String OPERATING_SYSTEM_MBEAN_NAME
OperatingSystemMBean.
public static final String RUNTIME_MBEAN_NAME
RuntimeMBean.
public static final String THREAD_MBEAN_NAME
ThreadMBean.
public static final String GARBAGE_COLLECTOR_MBEAN_DOMAIN_TYPE
GarbageCollectorMBean.
The unique ObjectName for a GarbageCollectorMBean
can be formed by appending this string with
",name=collector's name".
public static final String MEMORY_MANAGER_MBEAN_DOMAIN_TYPE
MemoryManagerMBean.
The unique ObjectName for a MemoryManagerMBean
can be formed by appending this string with
",name=manager's name".
public static final String MEMORY_POOL_MBEAN_DOMAIN_TYPE
MemoryPoolMBean.
The unique ObjectName for a MemoryPoolMBean
can be formed by appending this string with
,name=pool's name.
| Method Detail |
|---|
public static ClassLoadingMBean getClassLoadingMBean()
ClassLoadingMBean object for
the Java virtual machine.public static MemoryMBean getMemoryMBean()
MemoryMBean object for the Java virtual machine.public static ThreadMBean getThreadMBean()
ThreadMBean object for the Java virtual machine.public static RuntimeMBean getRuntimeMBean()
RuntimeMBean object for the Java virtual machine.public static CompilationMBean getCompilationMBean()
CompilationMBean object for the Java virtual
machine or null if the Java virtual machine has
no compilation system.public static OperatingSystemMBean getOperatingSystemMBean()
OperatingSystemMBean object for
the Java virtual machine.public static List getMemoryPoolMBeans()
MemoryPoolMBean objects in the
Java virtual machine.
The Java virtual machine can have one or more memory pools.
It may add or remove memory pools during execution.
public static List getMemoryManagerMBeans()
MemoryManagerMBean objects
in the Java virtual machine.
The Java virtual machine can have one or more memory managers.
It may add or remove memory managers during execution.
public static List getGarbageCollectorMBeans()
GarbageCollectorMBean objects
in the Java virtual machine.
The Java virtual machine may have one or more
GarbageCollectorMBean objects.
It may add or remove GarbageCollectorMBean
during execution.
public static MBeanServer getPlatformMBeanServer()
MBeanServer. On the first call
to this method, it first creates the platform MBeanServer
by calling the MBeanServerFactory.createMBeanServer()
method and registers the platform MBeans in this platform
MBeanServer using the MBean names
defined in the class description.
This method, in subsequent calls, will simply return the
initially created platform MBeanServer.
MBeans that get created and destroyed dynamically, for example,
memory pools and
managers,
will automatically be registered and deregistered into the platform
MBeanServer.
If the system property javax.management.builder.initial
is set, the platform MBeanServer creation will be done
by the specified MBeanServerBuilder.
It is recommended that this platform MBeanServer also be used to register other application MBeans besides the platform MBeans. This will allow all MBeans to be published through the same MBeanServer and hence allow for easier network publishing and discovery. Name conflicts with the platform MBeans should be avoided.
SecurityException - if there is a security manager
and the caller does not have the permission required by
MBeanServerFactory.createMBeanServer().MBeanServerFactory,
MBeanServerFactory.createMBeanServer()