RFR: 8139982 Re-examine java.management dependency on java.util.logging.LoggingMXBean

Daniel Fuchs daniel.fuchs at oracle.com
Fri Apr 29 15:08:09 UTC 2016


Hi,

Please find below a patch [2] that eliminates a static
dependency of java.lang.management on java.util.logging.LoggingMXBean.

When JDK-6876135 was fixed, it introduced the PlatformLoggingMXBean
interface, and recommended using PlatformLoggingMXBean over
LoggingMXBean. However, it left a static dependency on 
java.util.logging.LoggingMXBean in java.lang.management:
The MBean registered in the MBeanServer was a private class
in ManagementFactoryHelper implementing a non standard interface
that extended both PlatformLoggingMXBean and LoggingMXBean.
(sun.management.ManagementFactoryHelper$LoggingMXBean)
(see https://bugs.openjdk.java.net/browse/JDK-6876135)

This patch proposes to relax the constraint on the
PlatformLoggingMXBean implementation - by no longer
forcing it to implement LoggingMXBean. This will allow
to get rid of the non standard interface, and make
the MBean declare "java.lang.management.PlatformLoggingMXBean"
as its MXBean interface.

To make it clear that PlatformLoggingMXBean should be
used instead of LoggingMXBean we also propose to deprecate
the java.util.logging.LoggingMXBean interface as well as
the LogManager.getLoggingMXBean() method (since it returns
a deprecated type). As of yet, there no intention of
removing any of these.

Backward Compatibility considerations:
--------------------------------------

1. Local clients which obtain an instance of the logging
MXBean by calling ManagementFactory.getPlatformMXBean(
             "java.util.logging:type=Logging",
              PlatformLoggingMXBean.class)
will no longer be able to cast the result on
java.util.logging.LoggingMXBean.
[There should be few, given that PlatformLoggingMXBean
   already has all the methods defined in LoggingMXBean]

2. ManagementFactory.getPlatformMBeanServer().isInstanceOf(
      ObjectName, "java.util.logging.LoggingMXBean")
will now return 'false' instead of 'true'.

3. The Logging MXBean MBeanInfo will now report that its
management interface is "java.lang.management.PlatformLoggingMXBean"
instead of "sun.management.ManagementFactoryHelper$LoggingMXBean".

4. Calls to ManagementFactory.newPlatformMXBeanProxy(
     MBeanServerConnection, ObjectName,
     java.util.logging.LoggingMXBean.class); and
JMX.newMXBeanProxy(MBeanServerConnection, ObjectName,
     java.util.logging.LoggingMXBean.class)
will continue to work as before.

5. Remote clients running previous version of the JDK
     should see no changes, except for the interface
     name in MBeanInfo, and the change in isInstanceOf
     reported in 2.

[1] JBS issue:
https://bugs.openjdk.java.net/browse/JDK-8139982

[2] webrev:
http://cr.openjdk.java.net/~dfuchs/8139982_webrev/webrev.06/index.html

best regards,

-- daniel



More information about the core-libs-dev mailing list