java.lang.management.ManagementFactoryAn application can access a platform MXBean in the following ways:
The platform MXBean interfaces use only the following data types:
When an attribute or operation of a platform MXBean is accessed via an MBeanServer, the data types are mapped as follows:
For example, the MemoryMXBean interface has the following getter and setter methods:
These attributes in the MBeanInfo of the MemoryMXBean have the following names and types:public MemoryUsage getHeapMemoryUsage(); public boolean isVerbose(); public void setVerbose(boolean value);
Attribute Name Type HeapMemoryUsage CompositeData representing MemoryUsage Verbose boolean
A Java virtual machine has zero or a single instance of the following management interfaces.
Management Interface ObjectName CompilationMXBean java.lang:type=Compilation
A Java virtual machine may have one or more instances of the following management interfaces.
Management Interface ObjectName GarbageCollectorMXBean java.lang:type=GarbageCollector,name=collector's name MemoryManagerMXBean java.lang:type=MemoryManager,name=manager's name MemoryPoolMXBean java.lang:type=MemoryPool,name=pool's name
| Field Summary | ||
static String |
CLASS_LOADING_MXBEAN_NAME String representation of the
ObjectName for the ClassLoadingMXBean. |
|
static String |
COMPILATION_MXBEAN_NAME String representation of the
ObjectName for the CompilationMXBean. |
|
static String |
GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE The domain name and the type key property in
the ObjectName for a GarbageCollectorMXBean. |
|
static String |
MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE The domain name and the type key property in
the ObjectName for a MemoryManagerMXBean. |
|
static String |
MEMORY_MXBEAN_NAME String representation of the
ObjectName for the MemoryMXBean. |
|
static String |
MEMORY_POOL_MXBEAN_DOMAIN_TYPE The domain name and the type key property in
the ObjectName for a MemoryPoolMXBean. |
|
static String |
OPERATING_SYSTEM_MXBEAN_NAME String representation of the
ObjectName for the OperatingSystemMXBean. |
|
static String |
RUNTIME_MXBEAN_NAME String representation of the
ObjectName for the RuntimeMXBean. |
|
static String |
THREAD_MXBEAN_NAME String representation of the
ObjectName for the ThreadMXBean. |
|
| Method Summary | ||
static ClassLoadingMXBean |
getClassLoadingMXBean() Returns the managed bean for the class loading system of
the Java virtual machine. |
|
static CompilationMXBean |
getCompilationMXBean() Returns the managed bean for the compilation system of
the Java virtual machine. |
|
static List<GarbageCollectorMXBean> |
getGarbageCollectorMXBeans() Returns a list of GarbageCollectorMXBean objects
in the Java virtual machine. |
|
static List<MemoryManagerMXBean> |
getMemoryManagerMXBeans() Returns a list of MemoryManagerMXBean objects
in the Java virtual machine. |
|
static MemoryMXBean |
getMemoryMXBean() Returns the managed bean for the memory system of
the Java virtual machine. |
|
static List<MemoryPoolMXBean> |
getMemoryPoolMXBeans() Returns a list of MemoryPoolMXBean objects in the
Java virtual machine. |
|
static OperatingSystemMXBean |
getOperatingSystemMXBean() Returns the managed bean for the operating system on which
the Java virtual machine is running. |
|
static javax.management.MBeanServer |
getPlatformMBeanServer() Returns the platform MBeanServer. |
|
static RuntimeMXBean |
getRuntimeMXBean() Returns the managed bean for the runtime system of
the Java virtual machine. |
|
static ThreadMXBean |
getThreadMXBean() Returns the managed bean for the thread system of
the Java virtual machine. |
|
static T |
newPlatformMXBeanProxy(javax.management.MBeanServerConnection connection, String mxbeanName, Class<T> mxbeanInterface) Returns a proxy for a platform MXBean interface of a
given MXBean name
that forwards its method calls through the given
MBeanServerConnection. |
|
| Methods inherited from class java.lang.Object |
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MXBeans 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 javax.management.MBeanServerBuilder.
It is recommended that this platform MBeanServer also be used to register other application managed beans besides the platform MXBeans. 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 MXBeans should be avoided.
This method is equivalent to:
Proxy.newProxyInstance(mxbeanInterface.getClassLoader(), new Class[] { mxbeanInterface }, handler)where handler is an InvocationHandler to which method invocations to the MXBean interface are dispatched. This handler converts an input parameter from an MXBean data type to its mapped open type before forwarding to the MBeanServer and converts a return value from an MXBean method call through the MBeanServer from an open type to the corresponding return type declared in the MXBean interface.
If the MXBean is a notification emitter (i.e., it implements NotificationEmitter), both the mxbeanInterface and NotificationEmitter will be implemented by this proxy.
Notes: