public class Management extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Management.Registration
Result of
registerMBean invocation. |
Modifier and Type | Method and Description |
---|---|
static String |
getMBeanNameForClass(Class<?> clazz)
Convenient method to get an MBean name for a singleton class.
|
static Management.Registration |
registerMBean(Object mbean,
Class<?> mbeanInterface,
String name)
Convenient method to register JMX MBean with a specified management interface.
|
static DynamicMBean |
wrapMBean(Object mbean,
Class<?> mbeanInterface)
Wraps MBean into a dynamic MBean with support for annotation-based descriptions.
|
public static String getMBeanNameForClass(Class<?> clazz)
<package>:type=<class-name>
public static Management.Registration registerMBean(Object mbean, Class<?> mbeanInterface, String name)
wrapMBean(mbean, mbeanInterface)
to convert this MBean
into DynamicMBean and then registers it in the
platform MBeanServer
.
This methods ignores all unexpected errors that might happen during an attempt to register
MBean and logs them. The resulting Management.Registration
will return true on its
hasFailed()
method.
When bean with the corresponding name is already registered, then the resulting Management.Registration
will return true on its hasExisted()
method.
mbean
- the MBean to be registered.mbeanInterface
- the Management Interface exported by this MBean's implementation.
If null, then this object will use standard JMX design pattern to determine the management
interface associated with the given implementation.name
- the object name of MBean.
Use getMBeanNameForClass(Class)
to register a singleton mbean instance.unregister
the bean when it
is no longer needed.public static DynamicMBean wrapMBean(Object mbean, Class<?> mbeanInterface)
Description
annotation (ManagementDescription
is deprecated)
to provide description text and, for operation, parameter names and descriptions.
This method just returns mbean if it already implements DynamicMBean
interface.
This method retrieves each readable MBean attribute and if it throws
UnsupportedOperationException
, then the corresponding attribute is not
included into meta-information of the resulting dynamic MBean.
When mbeanInterface
is null, then this method also supports MXBean naming convention by
checking if mbean instance implements interface with a suffix "MXBean".
The bean with "MXBean" interface is registered as an MXBean with open types
(assuming all its operations and attributes are compatible with open types).
mbean
- the MBean to be registered.mbeanInterface
- the Management Interface exported by this MBean's implementation.
If null, then this object will use standard JMX design pattern to determine the management
interface associated with the given implementation.IllegalArgumentException
- if mbean and/or interface is not compliant with JMX specification.Copyright © 2002–2025 Devexperts LLC. All rights reserved.