Search in sources :

Example 1 with HotspotInternal

use of sun.management.HotspotInternal in project jvm-tools by aragozin.

the class HotspotInternalMBeanEnabler method start.

@Override
public void start(Properties agentProps, String agentArgs, Instrumentation inst) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {
    try {
        String mname = "sun.management:type=HotspotThreading";
        MBeanInfo info = ManagementFactory.getPlatformMBeanServer().getMBeanInfo(new ObjectName(mname));
        if (info != null) {
            // bean is present
            agentProps.put(this.getClass().getName() + ".enabled", "true");
            return;
        }
    } catch (Exception e) {
    // ignore
    }
    HotspotInternal hi = new HotspotInternal();
    ManagementFactory.getPlatformMBeanServer().registerMBean(hi, null);
    agentProps.put(this.getClass().getName() + ".enabled", "true");
}
Also used : HotspotInternal(sun.management.HotspotInternal) MBeanInfo(javax.management.MBeanInfo) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName)

Aggregations

InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 MBeanInfo (javax.management.MBeanInfo)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)1 ObjectName (javax.management.ObjectName)1 HotspotInternal (sun.management.HotspotInternal)1