2 Replies Latest reply on Jul 24, 2013 8:12 AM by Jozef Hartinger

    JMX annotation support in CDI?

    Elias Ross Master

      I wrote a CDI extension that processes some of the proposed javax.management annotions. These didn't make it into Java 7 but will hopefully appear in Java 8.


      Here is a coding example:


      import javax.inject.Inject;
      import javax.management.Description;
      import javax.management.Impact;
      import javax.management.MBean;
      import javax.management.MBeanServer;
      import javax.management.ManagedAttribute;
      import javax.management.ManagedOperation;
      import javax.management.NotificationInfo;
      import javax.management.NotificationInfos;
      import javax.management.ObjectNameTemplate;
      public class Counter implements CounterMBean {
          private MBeanServer server;
          private int counter;
          private String name;
          @Description("Resets the counter to zero")
          public void resetCounter() {
              counter = 0;


      Basically the extension finds all the @MBeans and registers/unregisters them, with the appropriate name and descriptions, etc.


      This extension works well for me, but I don't know if something is already in the works or there really isn't any more interest in CDI extensions. (The http://seamframework.org/Community/CDIExtensions site seems a bit...inactive.)