Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6323980

Annotations to simplify MBean development

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 7
    • Component/s: core-svc
    • Subcomponent:
    • Resolved In Build:
      b32
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Today creating a Standard MBean means writing an interface that defines the management interface, and a class that implements that interface. This could be made simpler using annotations.

      In the simplest case, you could eliminate the interface and instead add a @Management annotation to each public method that is part of the management interface.

      @MBean
      public class MyResource {
          @Management
          public int getCacheSize() {...}
          @Management
          public void setCacheSize(int x) {...}
          ...other stuff unrelated to management...
      }

      You could also use annotations to control what the name of the MBean is, for example by saying that its name is derived from the values of the Foo and Bar attributes.

      @MBean(type = "MyResource")
      public class MyResource {
          @MBeanNameKey("foo")
          public String getFoo() {...}
          @MBeanNameKey("bar")
          public int getBar() {...}
      }

      Although there are some tricky implementation questions, it would be great if you could tag a private field as being an attribute:

      public class MyResource {
          @MBeanAttribute("RequestCount")
          private int requestCount;

          public Result request(...) {
              requestCount++;
              ...
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              emcmanus Eamonn McManus
              Reporter:
              emcmanus Eamonn McManus
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: