hmi.util
Class ThreadDeadlockDetector

java.lang.Object
  extended by hmi.util.ThreadDeadlockDetector

public class ThreadDeadlockDetector
extends Object

Some class for deadlock detection

Author:
Elliott Hughes (?)

Nested Class Summary
static interface ThreadDeadlockDetector.Listener
          This is called whenever a problem with threads is detected.
 
Field Summary
private static int DEFAULT_DEADLOCK_CHECK_PERIOD
          The number of milliseconds between checking for deadlocks.
private  Collection<ThreadDeadlockDetector.Listener> listeners
           
private  ThreadMXBean mbean
           
private  Timer threadCheck
           
private static long TIMERDELAY
           
 
Constructor Summary
ThreadDeadlockDetector()
           
ThreadDeadlockDetector(int deadlockCheckPeriod)
           
 
Method Summary
 boolean addListener(ThreadDeadlockDetector.Listener l)
           
private  void checkForDeadlocks()
           
private  long[] findDeadlockedThreads()
           
private  Thread findMatchingThread(ThreadInfo inf)
           
private  void fireDeadlockDetected(Thread[] threads)
           
 boolean removeListener(ThreadDeadlockDetector.Listener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadCheck

private final Timer threadCheck

mbean

private final ThreadMXBean mbean

listeners

private final Collection<ThreadDeadlockDetector.Listener> listeners

DEFAULT_DEADLOCK_CHECK_PERIOD

private static final int DEFAULT_DEADLOCK_CHECK_PERIOD
The number of milliseconds between checking for deadlocks. It may be expensive to check for deadlocks, and it is not critical to know so quickly.

See Also:
Constant Field Values

TIMERDELAY

private static final long TIMERDELAY
See Also:
Constant Field Values
Constructor Detail

ThreadDeadlockDetector

public ThreadDeadlockDetector()

ThreadDeadlockDetector

public ThreadDeadlockDetector(int deadlockCheckPeriod)
Method Detail

checkForDeadlocks

private void checkForDeadlocks()

findDeadlockedThreads

private long[] findDeadlockedThreads()

fireDeadlockDetected

private void fireDeadlockDetected(Thread[] threads)

findMatchingThread

private Thread findMatchingThread(ThreadInfo inf)

addListener

public boolean addListener(ThreadDeadlockDetector.Listener l)

removeListener

public boolean removeListener(ThreadDeadlockDetector.Listener l)