-
Sub-task
-
Resolution: Delivered
-
P3
-
9
-
Verified
In Java SE 9 the `java.util.logging.LoggingMXBean` interface is deprecated in favor of the `java.lang.management.PlatformLoggingMXBean` interface.
The `java.util.logging.LogManager.getLoggingMXBean()` method is also deprecated in favor of `java.lang.mangement.ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)`.
The concrete implementation of the logging MXBean registered in the MBeanServer and obtained from the ManagementFactory will only implement `java.lang.management.PlatformLoggingMXBean`, and no longer `java.util.logging.LoggingMXBean`. It must be noted that `PlatformLoggingMXBean` and `LoggingMXBean` attributes are exactly the same. The `PlatformLoggingMXBean` interface has all the methods defined in `LoggingMXBean`, and so `PlatformLoggingMXBean` by itself provides the full management capability of logging facility.
This should be mostly transparent to remote and local clients of the API.
<b>Compatibility:</b>
Calls to `ManagementFactory.newPlatformMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)`
and calls to `JMX.newMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)` will continue to work as before.
Remote clients running any version of the JDK should see no changes, except for the interface name in `MBeanInfo`, and the change in `isInstanceOf`
reported in 1. and 2. below.
The behavioral change and source incompatibility due to this change are as follows:
1. `ManagementFactory.getPlatformMBeanServer().isInstanceOf(ObjectName, "java.util.logging.LoggingMXBean")` will now return '`false`' instead of '`true`'.<br>
If an application depends on this, then a workaround is to change the source of the calling code to check for `java.lang.management.PlatformLoggingMXBean` instead.
2. The Logging MXBean `MBeanInfo` will now report that its management interface is `java.lang.management.PlatformLoggingMXBean` instead of the non standard `sun.management.ManagementFactoryHelper$LoggingMXBean` name it used to display.<br>
The new behavior has the advantage that the reported interface name is now a standard class.
3. Local clients which obtain an instance of the logging MXBean by calling `ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)` will no longer be able to cast the result to `java.util.logging.LoggingMXBean`.<br>
`PlatformLoggingMXBean` already has all the methods defined in `LoggingMXBean`, therefore a simple workaround is to change the code to accept `PlatformLoggingMXBean` instead - or change it to use the deprecated `LogManager.getLoggingMXBean()` instead.
The `java.util.logging.LogManager.getLoggingMXBean()` method is also deprecated in favor of `java.lang.mangement.ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)`.
The concrete implementation of the logging MXBean registered in the MBeanServer and obtained from the ManagementFactory will only implement `java.lang.management.PlatformLoggingMXBean`, and no longer `java.util.logging.LoggingMXBean`. It must be noted that `PlatformLoggingMXBean` and `LoggingMXBean` attributes are exactly the same. The `PlatformLoggingMXBean` interface has all the methods defined in `LoggingMXBean`, and so `PlatformLoggingMXBean` by itself provides the full management capability of logging facility.
This should be mostly transparent to remote and local clients of the API.
<b>Compatibility:</b>
Calls to `ManagementFactory.newPlatformMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)`
and calls to `JMX.newMXBeanProxy(MBeanServerConnection, ObjectName, java.util.logging.LoggingMXBean.class)` will continue to work as before.
Remote clients running any version of the JDK should see no changes, except for the interface name in `MBeanInfo`, and the change in `isInstanceOf`
reported in 1. and 2. below.
The behavioral change and source incompatibility due to this change are as follows:
1. `ManagementFactory.getPlatformMBeanServer().isInstanceOf(ObjectName, "java.util.logging.LoggingMXBean")` will now return '`false`' instead of '`true`'.<br>
If an application depends on this, then a workaround is to change the source of the calling code to check for `java.lang.management.PlatformLoggingMXBean` instead.
2. The Logging MXBean `MBeanInfo` will now report that its management interface is `java.lang.management.PlatformLoggingMXBean` instead of the non standard `sun.management.ManagementFactoryHelper$LoggingMXBean` name it used to display.<br>
The new behavior has the advantage that the reported interface name is now a standard class.
3. Local clients which obtain an instance of the logging MXBean by calling `ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class)` will no longer be able to cast the result to `java.util.logging.LoggingMXBean`.<br>
`PlatformLoggingMXBean` already has all the methods defined in `LoggingMXBean`, therefore a simple workaround is to change the code to accept `PlatformLoggingMXBean` instead - or change it to use the deprecated `LogManager.getLoggingMXBean()` instead.
- relates to
-
JDK-8157055 consider unified release notes for deprecated APIs
- Closed