jutil
Class ThreadManager

java.lang.Object
  extended by jutil.ThreadManager

public class ThreadManager
extends java.lang.Object

The thread manager is an extensible class that safely manages a pool of worker threads.


Field Summary
private  java.util.List workers
          The pool of worker threads to be managed.
 
Constructor Summary
ThreadManager()
           
 
Method Summary
 void add(WorkerThread worker)
          Add a worker thread to the pool.
 void clear()
          clear workers list.
 void haltAll()
          Safely halts all workers
 void joinAll()
          Joins all workers.
 void joinAll(long msecs)
          Join all workers until the stop or a timeout occurs.
 void pauseAll()
          Safely pauses all workers.
 void startAll()
          Start all workers.
 java.lang.String toString()
           
 void unpauseAll()
          Safely unpauses all the workers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

workers

private java.util.List workers
The pool of worker threads to be managed.

Constructor Detail

ThreadManager

public ThreadManager()
Method Detail

clear

public void clear()
clear workers list.


add

public void add(WorkerThread worker)
Add a worker thread to the pool.

Parameters:
worker - the worker to be added to the list.

pauseAll

public void pauseAll()
Safely pauses all workers.


unpauseAll

public void unpauseAll()
Safely unpauses all the workers.


haltAll

public void haltAll()
Safely halts all workers


startAll

public void startAll()
Start all workers.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

joinAll

public void joinAll()
Joins all workers.


joinAll

public void joinAll(long msecs)
Join all workers until the stop or a timeout occurs.

Parameters:
msecs - number of milliseconds until a timeout