java.lang.ObjectThe {@code ManagementFactory} class is a factory class for getting managed beans for the Java platform. This class consists of static methods each of which returns one or more platform MXBeans representing the management interface of a component of the Java virtual machine.java.lang.management.ManagementFactory
A platform MXBean is a managed bean that conforms to the JMX Instrumentation Specification and only uses a set of basic data types. A JMX management application and the {@linkplain #getPlatformMBeanServer platform MBeanServer} can interoperate without requiring classes for MXBean specific data types. The data types being transmitted between the JMX connector server and the connector client are {@linkplain javax.management.openmbean.OpenType open types} and this allows interoperation across versions. See the specification of MXBeans for details.
Each platform MXBean is a PlatformManagedObject and it has a unique ObjectName for registration in the platform {@code MBeanServer} as returned by by the getObjectName method.
An application can access a platform MXBean in the following ways:
- Get an MXBean instance by calling the getPlatformMXBean or getPlatformMXBeans method and access the MXBean locally in the running virtual machine.
- Construct an MXBean proxy instance that forwards the method calls to a given MBeanServer by calling the #getPlatformMXBean(MBeanServerConnection, Class) or #getPlatformMXBeans(MBeanServerConnection, Class) method. The newPlatformMXBeanProxy method can also be used to construct an MXBean proxy instance of a given {@code ObjectName}. A proxy is typically constructed to remotely access an MXBean of another running virtual machine.
2. Indirect access to an MXBean interface via MBeanServer
- Go through the platform {@code MBeanServer} to access MXBeans locally or a specific MBeanServerConnection to access MXBeans remotely. The attributes and operations of an MXBean use only JMX open types which include basic data types, CompositeData , and TabularData defined in OpenType . The mapping is specified in the {@linkplain javax.management.MXBean MXBean} specification for details.
The getPlatformManagementInterfaces method returns all management interfaces supported in the Java virtual machine including the standard management interfaces listed in the tables below as well as the management interfaces extended by the JDK implementation.
A Java virtual machine has a single instance of the following management interfaces:
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 BufferPoolMXBean {@code java.nio:type=BufferPool,name=}pool name
Mandy - Chung1.5 - | Field Summary | ||
|---|---|---|
| public static final String | CLASS_LOADING_MXBEAN_NAME | String representation of the ObjectName for the ClassLoadingMXBean . |
| public static final String | COMPILATION_MXBEAN_NAME | String representation of the ObjectName for the CompilationMXBean . |
| public static final String | MEMORY_MXBEAN_NAME | String representation of the ObjectName for the MemoryMXBean . |
| public static final String | OPERATING_SYSTEM_MXBEAN_NAME | String representation of the ObjectName for the OperatingSystemMXBean . |
| public static final String | RUNTIME_MXBEAN_NAME | String representation of the ObjectName for the RuntimeMXBean . |
| public static final String | THREAD_MXBEAN_NAME | String representation of the ObjectName for the ThreadMXBean . |
| public static final String | GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE | The domain name and the type key property in the ObjectName for a GarbageCollectorMXBean . The unique ObjectName for a GarbageCollectorMXBean can be formed by appending this string with ",name=collector's name". |
| public static final String | MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE | The domain name and the type key property in the ObjectName for a MemoryManagerMXBean . The unique ObjectName for a MemoryManagerMXBean can be formed by appending this string with ",name=manager's name". |
| public static final String | MEMORY_POOL_MXBEAN_DOMAIN_TYPE | The domain name and the type key property in the ObjectName for a MemoryPoolMXBean . The unique ObjectName for a MemoryPoolMXBean can be formed by appending this string with ,name=pool's name. |
| Method from java.lang.management.ManagementFactory Summary: |
|---|
| getClassLoadingMXBean, getCompilationMXBean, getGarbageCollectorMXBeans, getMemoryMXBean, getMemoryManagerMXBeans, getMemoryPoolMXBeans, getOperatingSystemMXBean, getPlatformMBeanServer, getPlatformMXBean, getPlatformMXBean, getPlatformMXBeans, getPlatformMXBeans, getPlatformManagementInterfaces, getRuntimeMXBean, getThreadMXBean, newPlatformMXBeanProxy |
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.lang.management.ManagementFactory Detail: |
|---|
|
|
|
|
|
|
|
MXBeans that get created and destroyed dynamically, for example, memory pools and managers , will automatically be registered and deregistered into the platform {@code MBeanServer}. If the system property {@code javax.management.builder.initial} is set, the platform {@code 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 {@code MBeanServer} and hence allow for easier network publishing and discovery. Name conflicts with the platform MXBeans should be avoided. |
getPlatformMXBeans(mxbeanInterface) .get(0); |
Class)
mxbeanInterface) .get(0);
|
|
|
|
|
|
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: |