org.apache.axis.components.threadpool

Class ThreadPool

public class ThreadPool extends Object

Author: James M Snell (jasnell@us.ibm.com)

Field Summary
static intDEFAULT_MAX_THREADS
protected static Loglog
protected longthreadcount
protected Mapthreads
boolean_shutdown
Constructor Summary
ThreadPool()
ThreadPool(int maxPoolSize)
Method Summary
voidaddWorker(Runnable worker)
Adds a new worker to the pool
voidawaitShutdown()
Await shutdown of the worker
booleanawaitShutdown(long timeout)
Await shutdown of the worker
voidcleanup()
longgetWorkerCount()
Returns the total number of currently active workers
voidinterruptAll()
Forcefully interrupt all workers
booleanisShutdown()
Returns true if all workers have been shutdown
booleanisShuttingDown()
Returns true if all workers are in the process of shutting down
voidsafeShutdown()
Forcefully shutdown the pool
voidshutdown()
Forcefully shutdown the pool
voidworkerDone(Runnable worker, boolean restart)
Used by MessageWorkers to notify the pool that it is done

Field Detail

DEFAULT_MAX_THREADS

public static final int DEFAULT_MAX_THREADS

log

protected static Log log

threadcount

protected long threadcount

threads

protected Map threads

_shutdown

public boolean _shutdown

Constructor Detail

ThreadPool

public ThreadPool()

ThreadPool

public ThreadPool(int maxPoolSize)

Method Detail

addWorker

public void addWorker(Runnable worker)
Adds a new worker to the pool

awaitShutdown

public void awaitShutdown()
Await shutdown of the worker

awaitShutdown

public boolean awaitShutdown(long timeout)
Await shutdown of the worker

cleanup

public void cleanup()

getWorkerCount

public long getWorkerCount()
Returns the total number of currently active workers

interruptAll

public void interruptAll()
Forcefully interrupt all workers

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

safeShutdown

public void safeShutdown()
Forcefully shutdown the pool

shutdown

public void shutdown()
Forcefully shutdown the pool

workerDone

public void workerDone(Runnable worker, boolean restart)
Used by MessageWorkers to notify the pool that it is done
Copyright B) 2005 Apache Web Services Project. All Rights Reserved.