public class JmxExporter extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
REGISTRATION_FAIL_ON_EXISTING
Constant indicating that registration should fail when
attempting to register an MBean under a name that already exists.
|
static int |
REGISTRATION_IGNORE_EXISTING
Constant indicating that registration should ignore the affected MBean
when attempting to register an MBean under a name that already exists.
|
static int |
REGISTRATION_REPLACE_EXISTING
Constant indicating that registration should replace the affected MBean
when attempting to register an MBean under a name that already exists.
|
| Constructor and Description |
|---|
JmxExporter() |
JmxExporter(MBeanServer mbeanServer) |
JmxExporter(MBeanServer mbeanServer,
int registrationBehaviour) |
| Modifier and Type | Method and Description |
|---|---|
MBeanServer |
getMBeanServer() |
ObjectName |
register(Connector connector) |
void |
registerMBean(Object mbean,
ObjectName objectName)
Actually register the MBean with the server.
|
void |
setRegistrationBehavior(int registrationBehaviour)
Specify what action should be taken when attempting to register an MBean
under an
ObjectName that already exists. |
public static final int REGISTRATION_FAIL_ON_EXISTING
This is the default registration behaviour.
public static final int REGISTRATION_IGNORE_EXISTING
public static final int REGISTRATION_REPLACE_EXISTING
public JmxExporter(MBeanServer mbeanServer, int registrationBehaviour)
public JmxExporter(MBeanServer mbeanServer)
public JmxExporter()
throws JMException
JMExceptionpublic void setRegistrationBehavior(int registrationBehaviour)
ObjectName that already exists.
Default is REGISTRATION_FAIL_ON_EXISTING.
public ObjectName register(Connector connector)
public MBeanServer getMBeanServer()
public void registerMBean(Object mbean, ObjectName objectName) throws JMException
setRegistrationBehavior(int).
This design (and also code) was unashamedly cribbed from Spring's
MBeanRegistrationSupport
class. Thanks Spring team!mbean - objectName - JMExceptionREGISTRATION_FAIL_ON_EXISTING,
REGISTRATION_IGNORE_EXISTING,
REGISTRATION_REPLACE_EXISTINGCopyright © 2021. All rights reserved.