Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1.  Define MXBean interface
  2. Implement MXBean interface with MBean class
  3. Register the MBean
  4. Federate the MBean

Define MXBean interface

The MXBean interface provides the JMX bean's attributes and operations.

Code Block
languagejava
titleDefine MXBean Interface
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
languagejava
titleImplement MBean Class
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.

...