jgroup.util
Class ThreadMonitor

java.lang.Object
  extended by java.lang.Thread
      extended by jgroup.util.ThreadMonitor
All Implemented Interfaces:
java.lang.Runnable

public class ThreadMonitor
extends java.lang.Thread

Monitor threads to detect thread failures, and perform corrective action in case some thread has crashed.

This class is helpful with respect to debugging deadlock problems, especially when DUMP_ALL_THREADS is set to true. This will, at regular intervals, dump the stack trace of all threads allowing the developer to identify threads that might have entered into a deadlock situation awaiting a lock being held by another thread.

This class requires JDK 5.0, but is not mandatory for general use of Jgroup/ARM, and as such use of this class may be disabled.

Since:
Jgroup 2.1
Author:
Hein Meling

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static void add(java.lang.Thread thread)
          Add the given thread to the monitor.
static void dumpAllThreads()
           
static void remove(java.lang.Thread thread)
          Remove the given thread from being monitored.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

add

public static void add(java.lang.Thread thread)
Add the given thread to the monitor.


remove

public static void remove(java.lang.Thread thread)
Remove the given thread from being monitored.


dumpAllThreads

public static void dumpAllThreads()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.