Monitoring Java Safepoint Time in JDK16+

David Holmes david.holmes at oracle.com
Fri Jun 18 06:47:35 UTC 2021


On 18/06/2021 4:35 pm, Alan Bateman wrote:
> On 17/06/2021 22:44, David Holmes wrote:
>>
>> I must admit I'm a bit confused about these implementation-specific 
>> MBeans. They are implementation-specific, so no part of the primary 
>> java.management namespace, but they are provided so that they can be 
>> used - so shutting them behind the modular doors (so to speak) really 
>> doesn't make much sense to me.
> The JDK-specific MBeans are in the com.sun.management package, exported 
> by the jdk.management module.  The sun.management.* classes have always 
> been JDK-internal implementation classes and were never mean to be used 
> directly by code outside of the JDK. Directly referencing these classes 
> would have been a warning at compile prior with JDK 8 and older. It 
> changed an error at compile time in JDK 9.

Ah! I now see:

    /**
      * This method is for testing only.
      */
     public static synchronized HotspotRuntimeMBean 
getHotspotRuntimeMBean() {
         if (hsRuntimeMBean == null) {
             hsRuntimeMBean = new HotspotRuntime(jvm);
         }
         return hsRuntimeMBean;
     }

in sun.management.ManagementFactoryHelper. So it seems there is no 
actual _use_ of these platform-specific MBeans even within the JDK. So 
their existence seems somewhat pointless.

Cheers,
David


> -Alan


More information about the serviceability-dev mailing list