JDK-5072197 : RFE: OpenMBeanNotificationInfo
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2004-07-08
  • Updated: 2005-06-22
  • Resolved: 2005-06-22
Related Reports
Relates :  
javax.management.openmbean defines various OpenMBean*Info classes that restrict the corresponding MBean*Info classes so that they can only refer to Open Types.  (More accurately, OpenMBeanAttributeInfo for example is an interface, implemented by OpenMBeanAttributeInfoSupport, which itself extends MBeanAttributeInfo.)  However, there is no OpenMBeanNotificationInfo.

The proposal would be to define an interface OpenMBeanNotificationInfo that includes all the methods from MBeanNotificationInfo, plus this one:
    public OpenType getUserDataType();
The corresponding concrete class OpenMBeanNotificationInfoSupport would extend MBeanNotificationInfo and have the following constructor:
    public OpenMBeanNotificationInfoSupport(String[] notifTypes,
                                            String description,
                                            OpenType userDataType);

The idea is that notifications emitted by an Open MBean should be constrained so that (1) they are always instances of javax.management.Notification and not a subclass; and (2) their userData (returned by Notification.getUserData()) is always an instance of the specified userDataType.  This ensures, consistent with the idea of Open MBeans, that a client can always understand these notifications without requiring any additional Java classes.

The various OpenMBean*InfoSupport classes are not final, but they probably should be, since if someone plugs a subclass of one of them into an Open MBean's MBeanInfo, that MBeanInfo will not be understandable by a client that does not know that class.  (Serialization tricks with writeReplace are not enough because Java serialization is not the only way clients may interact with the MBean Server.)  Compatibility rules forbid making the existing classes final, but the new class OpenMBeanNotificationInfoSupport probably should be.

EVALUATION Straightforward extension, should be validated by the MXBean framework. ###@###.### 2004-07-08 Now that Descriptors are present in all types of MBean*Info, an alternative is simply to add an "openType" field to the Descriptor entry for a plain MBeanNotificationInfo. By convention, such a field describes the type of the userData. The main drawback of this approach is that the implementation does not verify that the associated value really is of a subclass of OpenType. ###@###.### 2005-06-07 14:51:53 GMT

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang

PUBLIC COMMENTS Add OpenMBeanNotificationInfo alongside existing OpenMBeanAttributeInfo etc.