JDK-6306219 : Clarify MBeanServer.isInstanceOf semantics for Dynamic MBeans
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-08-04
  • Updated: 2017-05-16
  • Resolved: 2006-02-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
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.

Comments
EVALUATION Spec change only. Other implementations may need to follow suit.
04-08-2005