Annotation Interface JmxAttributeMethod


@Retention(RUNTIME) @Target(METHOD) public @interface JmxAttributeMethod
This identifies which getter and setter methods you want exposed via JMX. This is added to methods that are in the form getXxx(), isXxx(), or setXxx() for the xxx field. The Xxx should match precisely to associate the get and set JMX features. For example, if you are getting and setting the fooBar field then it should be getFooBar() and setFooBar(). isFooBar() is also allowed if foobar is a boolean or Boolean field. Instead of annotating the methods, you can use the JmxAttributeField to annotate the fields you want to expose.

Notice that although the field-name is fooBar with a lowercase 'f', the method name camel-cases it and turns it into getFooBar() with a capital 'F'. This class is similar to Spring's @ManagedAttribute. In addition, the "getXxx()" method must not return void and must have no arguments. isXxx() is allowed if it returns boolean or Boolean and the method has no arguments. The "setXxx()" method must return void and must take a single argument -- the same argument as the getter returns.

@JmxAttributeMethod(description = "Number of times our cache was hit")
public int getCacheHitCount() {
Author:
graywatson
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Description of the attribute for jconsole.
  • Element Details

    • description

      String description
      Description of the attribute for jconsole. Default is something like: "someField attribute".
      Default:
      ""