com.purpletech.util
Class BasicThreadWatcher
java.lang.Object
|
+--com.purpletech.util.BasicThreadWatcher
- All Implemented Interfaces:
- java.lang.Runnable, Task, ThreadWatcher
- public class BasicThreadWatcher
- extends java.lang.Object
- implements Task, ThreadWatcher
Watches threads.
|
Method Summary |
boolean |
check()
|
int[] |
count()
|
static ThreadWatcher |
getDefault()
|
void |
print(java.io.PrintStream out)
|
void |
run()
|
void |
set(java.lang.String note)
register that the current thread is now running, and doing something
interesting, represented by the note param. |
void |
set(java.lang.Thread t,
int state,
java.lang.String note)
|
static void |
setDefault(ThreadWatcher tw)
|
void |
setIdle()
register that the current thread is now idle (which means it's
OK if it's blocked, waiting on IO for example) |
void |
setWatcher(ThreadWatcher w)
Even a watcher needs a watcher |
void |
start()
|
void |
stop()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
clear
public static java.lang.String clear
isVerbose
public boolean isVerbose
BasicThreadWatcher
public BasicThreadWatcher(int priority,
int pause,
int threshold,
java.io.PrintStream out,
boolean v)
BasicThreadWatcher
public BasicThreadWatcher()
setDefault
public static void setDefault(ThreadWatcher tw)
getDefault
public static ThreadWatcher getDefault()
set
public void set(java.lang.Thread t,
int state,
java.lang.String note)
- Specified by:
set in interface ThreadWatcher
- Parameters:
t - the thread we are watchingstate - the state constantnote - what the thread is doing
setIdle
public void setIdle()
- Description copied from interface:
ThreadWatcher
- register that the current thread is now idle (which means it's
OK if it's blocked, waiting on IO for example)
- Specified by:
setIdle in interface ThreadWatcher
set
public void set(java.lang.String note)
- Description copied from interface:
ThreadWatcher
- register that the current thread is now running, and doing something
interesting, represented by the note param. It would be bad if it
blocked now.
- Specified by:
set in interface ThreadWatcher
print
public void print(java.io.PrintStream out)
start
public void start()
stop
public void stop()
- Specified by:
stop in interface Task
run
public void run()
- Specified by:
run in interface java.lang.Runnable
setWatcher
public void setWatcher(ThreadWatcher w)
- Even a watcher needs a watcher
- Specified by:
setWatcher in interface Task
check
public boolean check()
- Returns:
- true if everything's OK
count
public int[] count()
- Returns:
- array[state] of the number of threads in each state