...
- Define MXBean interface
- Implement MXBean interface with MBean class
- Register the MBean
- Federate the MBean
Define MXBean interface
The MXBean interface provides the JMX bean's attributes and operations.
Code Block | ||||
---|---|---|---|---|
| ||||
public interface CustomMXBean { public int getCustomInt(); public String getCustomString(); public String[] listCustomStrings(); } |
Implement MXBean interface with MBean class
The MBean class provides the implementation of the MXBean.
Code Block | ||||
---|---|---|---|---|
| ||||
public class CustomMBean implements CustomMXBean { public int getCustomInt() { return someInt; } public String getCustomString() { return someString; } public String[] listCustomStrings() { return new String[] {"someString1", "someString2"}; } } |
Register the MBean
Registering the MBean causes the MBean to be available to JMX clients of the member. See below for code sample.
...