United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6610094 Add generic support for platform MXBeans of any type
JDK-6610094 : Add generic support for platform MXBeans of any type

Details
Type:
Enhancement
Submit Date:
2007-09-27
Status:
Closed
Updated Date:
2012-10-01
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-svc
OS:
generic
Sub-Component:
java.lang.management
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6,7
Fixed Versions:

Related Reports
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
The ObjectName of the platform MXBeans follows a convention where an ObjectName must have a "type" property.  A MXBean can have other key properties (e.g. MemoryManagerMXBean and MemoryPoolMXBean).  Currently, MemoryManagerMXBean and MemoryPoolMXBean have a "name" property whose value is its name obtained by the getName() method.

In JDK7, a new BufferPoolMXBean will be added and also has the "name" property in its ObjectName.  Propose to add a new NamedManagedObject interface:
  public interface NamedManagedObject {
      public String getName();
  }

All platform MXBeans that have a name property will implement this interface to enforce the ObjectName convention.  This will also simplify the implementation of the ManagementFactory.getPlatformMBeanServer() method to find all platform MXBeans and construct the ObjectName to register into a MBeanServer.
The java.lang.management API defines the management interfaces for the Java virtual machine.  The management interface for other components in the platform will reside in its own package.  For example, the management interface for the logging facility is java.util.logging.LoggingMXBean.
 
There is no easy way to find out what management interfaces are defined in the Java platform.  In addition, when a new management interface is added in the platform, it needs to provide a factory method to obtain the platform MXBeans (e.g. java.util.logging.LogManager.getLoggerMXBean()).  NIO and other components will define their management interfaces in the future JDK releases.

Need to add a generic support for platform MXBeans of any type to simplify the work required when a platform component adds the monitoring and management support for local as well as remote access.
This fix uses a new API in JDK7 so the following tests will
fail to compile on JDK6 (as expected):

    com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.sh
    com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java
    com/sun/management/HotSpotDiagnosticMXBean/GetVMOption.java
    com/sun/management/HotSpotDiagnosticMXBean/SetVMOption.java

This entry should cause any JDK6 failure to show up on the
fail_list instead of being considered "new" failures.

                                    

Comments
EVALUATION

Will fix in JDK 7 to prepare for new platform MXBeans to be added.
                                     
2007-09-27
EVALUATION

Add a new java.lang.management.PlatformManagedObject interface which provides
a method to return the object name. All existing MXBean interfaces will be
modified to extend this interface.
 
Add new methods the in java.lang.management.ManagementFactory class:
1) A getPlatformMXBeans(Class) method to return the list of platform MXBeans 
that implement a given management interface in the running JVM
 
2) A getPlatformMXBeans(MBeanServerConnection, Class) method to return the list
of platform MXBean proxies that implement a given management interface 
and in the given remote MBeanServerConnection
 
3) A getAllPlatformMXBeanInterfaces() method to return all MXBean interfaces 
for monitoring and managing the Java platform
                                     
2008-04-11
SUGGESTED FIX

Attached webrev.zip
                                     
2008-04-11



Hardware and Software, Engineered to Work Together