Class ThreadPool
- java.lang.Object
-
- org.apache.axis.components.threadpool.ThreadPool
-
public class ThreadPool extends java.lang.Object
- Author:
- James M Snell (jasnell@us.ibm.com)
-
-
Field Summary
Fields Modifier and Type Field Description boolean
_shutdown
static int
DEFAULT_MAX_THREADS
protected static org.apache.commons.logging.Log
log
protected long
threadcount
protected java.util.Map
threads
-
Constructor Summary
Constructors Constructor Description ThreadPool()
ThreadPool(int maxPoolSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWorker(java.lang.Runnable worker)
Adds a new worker to the poolvoid
awaitShutdown()
Await shutdown of the workerboolean
awaitShutdown(long timeout)
Await shutdown of the workervoid
cleanup()
long
getWorkerCount()
Returns the total number of currently active workersvoid
interruptAll()
Forcefully interrupt all workersboolean
isShutdown()
Returns true if all workers have been shutdownboolean
isShuttingDown()
Returns true if all workers are in the process of shutting downvoid
safeShutdown()
Forcefully shutdown the poolvoid
shutdown()
Forcefully shutdown the poolvoid
workerDone(java.lang.Runnable worker, boolean restart)
Used by MessageWorkers to notify the pool that it is done
-
-
-
Field Detail
-
log
protected static org.apache.commons.logging.Log log
-
DEFAULT_MAX_THREADS
public static final int DEFAULT_MAX_THREADS
- See Also:
- Constant Field Values
-
threads
protected java.util.Map threads
-
threadcount
protected long threadcount
-
_shutdown
public boolean _shutdown
-
-
Method Detail
-
cleanup
public void cleanup() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
isShutdown
public boolean isShutdown()
Returns true if all workers have been shutdown
-
isShuttingDown
public boolean isShuttingDown()
Returns true if all workers are in the process of shutting down
-
getWorkerCount
public long getWorkerCount()
Returns the total number of currently active workers
-
addWorker
public void addWorker(java.lang.Runnable worker)
Adds a new worker to the pool
-
interruptAll
public void interruptAll()
Forcefully interrupt all workers
-
shutdown
public void shutdown()
Forcefully shutdown the pool
-
safeShutdown
public void safeShutdown()
Forcefully shutdown the pool
-
awaitShutdown
public void awaitShutdown() throws java.lang.InterruptedException
Await shutdown of the worker- Throws:
java.lang.InterruptedException
-
awaitShutdown
public boolean awaitShutdown(long timeout) throws java.lang.InterruptedException
Await shutdown of the worker- Throws:
java.lang.InterruptedException
-
workerDone
public void workerDone(java.lang.Runnable worker, boolean restart)
Used by MessageWorkers to notify the pool that it is done
-
-