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 Mar 14, 2020 · 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
}

Easy Props will automatically register an MBean for your configuration object. In the previous example, the object will be exposed via JMX under the name org.jeasy.props:name=myConfig.

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.