final ThreadDeadlockMonitor threadDeadlockMonitor = new ThreadDeadlockMonitor();
ThreadMXBean threadMXBean = JMXUtil.getPlatformMXBeanProxy(mbs,
ManagementFactory.THREAD_MXBEAN_NAME,
ThreadMXBean.class);
threadDeadlockMonitor.setThreadMXBean(threadMXBean);
PeriodicWatch p = new PeriodicWatch("Thread Deadlock", config) {
public void checkValue() {
threadDeadlockMonitor.getThreadDeadlockCalculable();
}
};
p.setPeriod(10*1000); // 10 seconds
context.getWatchRegistry().register(p);
p.start();
logger.info("Started Provision Monitor [{}]", JiniClient.getDiscoveryAttributes(context));
} catch(Exception e) {
logger.error("Unrecoverable initialization exception", e);
destroy();