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

Clarify MBeanServer.isInstanceOf semantics for Dynamic MBeans

    Details

    • Subcomponent:
    • Resolved In Build:
      b71
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The specification of MBeanServer.isInstanceOf(name, className) says this:

          Let
          X be the MBean named by name,
          L be the ClassLoader of X,
          N be the class name in X's MBeanInfo.

          If N equals className, the result is true.

          Otherwise, if L successfully loads both N and className, and the second class is assignable from the first, the result is true.

          Otherwise, the result is false.

      This specification is correct for Standard MBeans. However, for Dynamic MBeans, the implemented behaviour is slightly different. It corresponds to the following specification:

          If N equals className, the result is true.

          Otherwise, if L successfully loads className and X is an instance of this class, the result is true.

          Otherwise, [remaining text as before]

      This makes a difference when a DynamicMBean returns in its MBeanInfo a class name of which it is not an instance. For example, an instance of javax.management.StandardMBean (which is a DynamicMBean) could return an MBeanInfo whose getClassName() returned "javax.management.timer.TimerMBean". Under the current specification, the call mbeanServer.isInstanceOf(objectName, "javax.management.StandardMBean") would then return false, since TimerMBean is not an instance of StandardMBean. In fact, it returns true, since the actual MBean object *is* an instance of StandardMBean.

      With the addition of the class StandardEmitterMBean, and the existing practice of using isInstanceOf to determine whether an MBean is a NotificationBroadcaster, it becomes important to change the spec to reflect the implementation. A StandardEmitterMBean will typically return an MBeanInfo with a class name that is not an NotificationBroadcaster; however, we want isInstanceOf(..., "javax.management.NotificationBroadcaster") to return true.

        Attachments

          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: