Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6175517
Votes 0
Synopsis Standardize a general-purpose MXBean framework
Category jmx:classes
Reported Against
Release Fixed mustang(b40)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 6254721 , 6278707 , 5072268
Submit Date 07-OCT-2004
Description
In J2SE 5, java.lang.management introduces the notion of MXBeans.  An MXBean is defined by a Java interface, the "MXBean interface".  This interface is similar to a Standard MBean interface -- it contains attributes that are defined by getX and setX methods, and its other methods are operations.  With MXBeans, however, the MBean that is actually registered in the MBean Server does not have exactly the same types for its attributes and operation parameters and return values.  Instead, each type that occurs in the MXBean interface is *converted* to a type built from the fixed set defined in javax.management.openmbean.  The MBean that is actually registered in the MBean Server is an Open MBean that references these converted types.  When it is accessed, it converts values between the original MXBean interface type and the converted Open MBean type.

In this way, a client can access an MXBean without needing to know any model-specific types that might be referenced in the MXBean interface.  The client only needs to know the standard Open MBean types.  So for example a generic JMX console can access any MXBean without need to load any non-standard classes.

A client that does know the model-specific classes, including the MXBean interface itself, can construct a proxy for the MXBean that references the original types.

For an example of MXBeans, see java.lang.management in J2SE 5.  The interface MemoryMXBean is an MXBean interface.  Its method:
    MemoryUsage getHeapMemoryUsage();
defines an attribute called HeapMemoryUsage.  The type of this attribute is converted from MemoryUsage to the Open MBean type CompositeData using rules that are explained in java.lang.management.  Thus, a client of the MBean Server will see an attribute with type CompositeData.

A client that knows the MemoryMXBean interface can construct a proxy using ManagementFactory.newPlatformMXBeanProxy:
    MemoryMXBean proxy =
        ManagementFactory.newPlatformMXBeanProxy(..., MemoryMXBean.class);
    MemoryUsage usage = proxy.getHeapMemoryUsage();

A desirable extension to the model would be for an MXBean to reference another MXBean.  For example, if the interface MemoryManagerMXBean defines a method like this:
    MemoryMXBean[] getMemoryMXBeans();
then that would define an attribute called MemoryMXBeans whose converted type would be ObjectName[].  For each MemoryMXBean instance in the array returned by the original getMemoryMXBeans() method, the MXBean framework would know what ObjectName that MXBean is registered under and return that name.  A proxy for MemoryManagerMXBean would be able to convert the ObjectName into another proxy, of type MemoryMXBean accessing the ObjectName in the same MBean Server as the original proxy.
  xxxxx@xxxxx   10/7/04 15:55 GMT
Work Around
N/A
Evaluation
An advanced prototype exists.  Conformance tests do not as yet.  Should be possible to do this for Mustang.
  xxxxx@xxxxx   10/7/04 15:55 GMT
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang