JDK-6610094 : Add generic support for platform MXBeans of any type
  • Type: Enhancement
  • Component: core-svc
  • Sub-Component: java.lang.management
  • Affected Version: 6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-09-27
  • Updated: 2017-05-16
  • Resolved: 2011-03-08
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 7
7 b27Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
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 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
11-04-2008

SUGGESTED FIX Attached webrev.zip
11-04-2008

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