Method getThreadDeadlockCalculable = ThreadDeadlockMonitor.class.getMethod("getThreadDeadlockCalculable");
ThreadDeadlockMonitor threadDeadlockMonitor = new ThreadDeadlockMonitor();
threadDeadlockMonitor.setThreadMXBean(ManagementFactory.getThreadMXBean());
WatchInjector watchInjector = new WatchInjector(this, context);
ThresholdWatch watch = (ThresholdWatch)watchInjector.inject(threadDeadlockDescriptor,
threadDeadlockMonitor,
getThreadDeadlockCalculable);
watch.setThresholdValues(new ThresholdValues(0, 1));
watch.addThresholdListener(new DeadlockedThreadPolicyHandler());
} else {
logger.info("Thread deadlock monitoring has been disabled. The " +
"configured thread deadlock check time was " +
"[{}]. To enable thread deadlock monitoring, the thread deadlock check " +
"time must be >= 1000 milliseconds.", threadDeadlockCheck);