Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Jmx Management

Mahmoud Ben Hassine edited this page Jul 17, 2016 · 4 revisions

You can make your configuration object manageable at runtime via JMX by adding the @Manageable annotation:

@Manageable(name = "myConfig")
public class ManageableConfig implements ManageableConfigMBean {

    @SystemProperty(value = "size")
    private int size;

    // getters and setters
}

The object must be JMX compliant (either by adding the @MXBean annotation or by implementing a management interface). Please refer to JMX documentation for more details on JMX compliant objects.

In the previous example, we made the ManageableConfig class JMX compliant by implementing the management interface ManageableConfigMBean:

public interface ManageableConfigMBean {

    int getSize();

    void setSize(int size);
}

This will allow the size property to be changed at runtime with any JMX client. The configuration object will be exposed through JMX under the name specified in the name attribute of the @Manageable annotation. In the previous example, it will be myConfig.