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");
}
Aggregations