Database Reference
In-Depth Information
BlockingQueue<Runnable> workQueue,
NamedThreadFactory threadFactory)
{
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,
threadFactory);
super.prestartAllCoreThreads();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbeanName = "org.apache.cassandra.concurrent:type=" + threadFactory.id;
try
{
mbs.registerMBean(this, new ObjectName(mbeanName));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
The platform server here is simply the default one embedded in the JDK. The MBean is named
and registered so that the MBean server knows to monitor it and make it manageable via the
agent.
In order to do proper cleanup, when the JMXEnabledThreadPoolExecutor is shut down, the
class will also unregister itself from the MBean server:
private void unregisterMBean()
{
try
{
ManagementFactory.getPlatformMBeanServer().unregisterMBean
(new ObjectName(mbeanName));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
Likewise, the StorageService class itself registers and unregisters with the MBean server for
the JMX properties that it maintains locally. So this implementation does all of the work that it is
intended to do, and then has implementations of the methods that are only necessary for talking
to the MBean server. For example, here is the StorageService implementation of the of the
getUnreachableNodes operation:
Search WWH ::




Custom Search