// find out the related JMX managed component do register and unregister things
public void processEvent(BusEvent event) throws BusException {
if (meFilter.isEventEnabled(event)) {
Instrumentation instrumentation = (Instrumentation)event.getSource();
if (meFilter.isCreateEvent(event)) {
ModelMBeanInfo mbi = mbAssembler.getModelMbeanInfo(instrumentation.getClass());
if (mbi != null) {
RequiredModelMBean rtMBean;
try {
rtMBean = (RequiredModelMBean)mbs.instantiate(
"javax.management.modelmbean.RequiredModelMBean");
rtMBean.setModelMBeanInfo(mbi);
rtMBean.setManagedResource(instrumentation, "ObjectReference");
registerMBean(rtMBean,
JMXUtils.getObjectName(instrumentation.getInstrumentationName(),
instrumentation.getUniqueInstrumentationName(),
busID));
if (LOG.isLoggable(Level.INFO)) {
LOG.info("registered the object to MBserver "
+ instrumentation.getUniqueInstrumentationName());
}
} catch (ReflectionException e) {
LOG.log(Level.SEVERE, "INSTANTIANTE_FAILURE_MSG", new Object[]{e});
} catch (MBeanException e) {
LOG.log(Level.SEVERE, "MBEAN_FAILURE_MSG", new Object[]{e});
} catch (InstanceNotFoundException e) {
LOG.log(Level.SEVERE, "SET_MANAGED_RESOURCE_FAILURE_MSG", new Object[]{e});
} catch (InvalidTargetObjectTypeException e) {
LOG.log(Level.SEVERE, "SET_MANAGED_RESOURCE_FAILURE_MSG", new Object[]{e});
}
} else {
LOG.log(Level.SEVERE, "GET_MANAGED_INFORMATION_FAILURE_MSG",
new Object[]{instrumentation.getInstrumentationName()});
}
}
if (meFilter.isRemovedEvent(event)) {
// unregist the component and distroy it.
ObjectName name;
name = JMXUtils.getObjectName(instrumentation.getInstrumentationName(),
instrumentation.getUniqueInstrumentationName(),
busID);
unregisterMBean(name);
if (LOG.isLoggable(Level.INFO)) {
LOG.info("unregistered the object to MBserver"
+ instrumentation.getUniqueInstrumentationName());
}
}
}
}