-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b06
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2209929 | 7 | James Melvin | P3 | Closed | Fixed | b30 |
The MXBean spec says:
---------------------------------------8<----------------------------------------
If the same MXBean were registered under two different ObjectNames, a reference to that MXBean from another MXBean would be ambiguous. Therefore, if an MXBean object is already registered in an MBean Server and an attempt is made to register it in the same MBean Server under another name, the result is an InstanceAlreadyExistsException.
---------------------------------------8<----------------------------------------
However, the following code does not throw the InstanceAlreadyExistsException:
---------------------------------------8<----------------------------------------
ObjectName objectName1 = new ObjectName("test:index=1");
ObjectName objectName2 = new ObjectName("test:index=2");
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
MXBC_SimpleClass01 mxBeanObject = new MXBC_SimpleClass01();
mbs.registerMBean(mxBeanObject, objectName1);
mbs.registerMBean(mxBeanObject, objectName2);
System.out.println("InstanceAlreadyExistsException is not thrown.");
---------------------------------------8<----------------------------------------
(the sample test class attached)
---------------------------------------8<----------------------------------------
If the same MXBean were registered under two different ObjectNames, a reference to that MXBean from another MXBean would be ambiguous. Therefore, if an MXBean object is already registered in an MBean Server and an attempt is made to register it in the same MBean Server under another name, the result is an InstanceAlreadyExistsException.
---------------------------------------8<----------------------------------------
However, the following code does not throw the InstanceAlreadyExistsException:
---------------------------------------8<----------------------------------------
ObjectName objectName1 = new ObjectName("test:index=1");
ObjectName objectName2 = new ObjectName("test:index=2");
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
MXBC_SimpleClass01 mxBeanObject = new MXBC_SimpleClass01();
mbs.registerMBean(mxBeanObject, objectName1);
mbs.registerMBean(mxBeanObject, objectName2);
System.out.println("InstanceAlreadyExistsException is not thrown.");
---------------------------------------8<----------------------------------------
(the sample test class attached)
- backported by
-
JDK-2209929 No InstanceAlreadyExistsException for the second registration of an MXBean object under dif. name
- Closed
- relates to
-
JDK-7045417 Regression test annotation for 6602326 requires new bug addition
- Closed
-
JDK-8344969 Remove the jmx.mxbean.multiname compatibility property
- Resolved