in src/main/java/org/apache/sling/discovery/impl/DiscoveryServiceImpl.java [208:228]
protected void registerMBean(BundleContext bundleContext) {
if (this.mbeanRegistration!=null) {
try{
if ( this.mbeanRegistration != null ) {
this.mbeanRegistration.unregister();
this.mbeanRegistration = null;
}
} catch(Exception e) {
logger.error("registerMBean: Error on unregister: "+e, e);
}
}
try {
final Dictionary<String, String> mbeanProps = new Hashtable<String, String>();
mbeanProps.put("jmx.objectname", "org.apache.sling:type=discovery,name=DiscoveryServiceImpl");
final DiscoveryServiceMBeanImpl mbean = new DiscoveryServiceMBeanImpl(heartbeatHandler);
this.mbeanRegistration = bundleContext.registerService(DiscoveryServiceMBeanImpl.class.getName(), mbean, mbeanProps);
} catch (Throwable t) {
logger.warn("registerMBean: Unable to register DiscoveryServiceImpl MBean", t);
}
}