util.debug
Class ThreadWatcher
java.lang.Object
|
+--util.debug.ThreadWatcher
- public class ThreadWatcher
- extends Object
This utility allows you to keep track of current threads running on
your VM. If you actually construct it, it will print the status
automatically every so often (you can specify that in the
constructor, otherwise, every minute).
You can also use the addToThreadHistory method to keep track where
the thread has been.
Field Summary |
protected static Hashtable |
history
Keeps track of all of the events reported for the thread |
protected int |
waitTime
|
Constructor Summary |
ThreadWatcher()
|
ThreadWatcher(int interval)
Creates a new ThreadWatcher instance and starts the
thread that will make periodic reports. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
waitTime
protected int waitTime
history
protected static Hashtable history
- Keeps track of all of the events reported for the thread
ThreadWatcher
public ThreadWatcher()
ThreadWatcher
public ThreadWatcher(int interval)
- Creates a new
ThreadWatcher
instance and starts the
thread that will make periodic reports.
- Parameters:
interval
- How often (in seconds) should the watcher report
on thread status
printThreadStatus
public static void printThreadStatus()
- Prints the status of all threads on this VM.
printThreadStatus
public static void printThreadStatus(ThreadGroup group)
- Prints the status of all threads in the specified ThreadGroup
printThreadStatus
public static void printThreadStatus(Thread thread)
- Prints the status of a specific thread
printThreadHistory
public static void printThreadHistory(Thread thread)
- Prints the history of a particular thread (this method is called
from printThreadStatus(Thread)
getTopThreadGroup
public static ThreadGroup getTopThreadGroup()
- Get the top-most ThreadGroup
addToThreadHistory
public static void addToThreadHistory(String historyItem)
- Add a piece of information to the history of the current thread
(not that this is a static method)