[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Start Using Quickly

To use SimpleJMX you need to do the following steps. For more information, see section Using SimpleJMX.

  1. Download SimpleJMX from the SimpleJMX release page. See section Downloading Jar.
  2. Add @JmxResource annotation to the top of each class you want to publish via JMX. See section Naming Objects.
    @JmxResource(domainName = "your.domain", description = "Runtime counter")
    public class RuntimeCounter {
  3. Add @JmxAttributeField annotation to each of the attribute fields that you want to expose via reflection over JMX. See section Exposing Fields and Methods.
    @JmxAttributeField(description = "Start time in millis",
       isWritable = true)
    private long startTimeMillis;

    If you want to annotate the get/set/is attribute methods instead then use the @JmxAttributeMethod annotation on those methods. See section @JmxAttributeMethod Annotation.

    @JmxAttributeMethod(description = "Run time in seconds or milliseconds")
    public long getRunTime() {
  4. Add @JmxOperation annotation to each of operation methods that you want to make accessable over JMX. See section @JmxOperation Annotation.
    @JmxOperation(description = "clear the cache")
    public void clearCache() {
  5. Start your JMX server. See section Starting a JMX Server.
    // create a new JMX server listening on a port
    JmxServer jmxServer = new JmxServer(8000);
  6. Register the objects you want to publish via JMX. See section Register Objects.

For more extensive instructions, see section Using SimpleJMX.

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Gray Watson on March 27, 2017 using texi2html 1.82.