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

MXBean spec should say what happens if you register the same MXBean under two names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • core-svc
    • b63
    • generic
    • generic

      The MXBean specification should say what happens if you register the same MXBean object under two different names in the same MBeanServer. Because of the support for inter-MXBean references (see the section "Mappings for MXBean interfaces" in the documentation for javax.management.MXBean), registering the same object twice is problematic. For example if I have MXBeans that look like this...

      public interface ProductMXBean {...}

      public interface ModuleMXBean {
          public ProductMXBean getProduct();
      }

      public class ModuleImpl implements ModuleMXBean {
          public ProductMXBean getProduct() {
              return myProduct;
          }
      }

      ...then ModuleMXBean has an attribute whose (mapped) type is ObjectName. If the myProduct object is registered under two names, then the ObjectName to return here is ambiguous.

      The current implementation simply refuses to register an MXBean object in an MBean Server if the object is already registered in that MBean Server. But the specification doesn't say this, much less detailing what exception is thrown.

      An alternative would be to allow multiple registration, but to throw an exception when an attempt is made to map the object to an ObjectName.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: