|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.ThreadGroup
|
+--org.jwarp.service.threadpool.ThreadPool
The ThreadPool manages a pool of threads.
In the thread pool, as its name suggests, some threads are waiting for
work to appear in the pool. As soon as there is work one of the waiting threads will take it and work on it.
The pool has an initial amount of threads which are created when the pool
is created. It has also a maximum limit to which he can extend the number
of threads. When work is added and no thread is currently waiting, the
pool creates a new thread unless the maximum count of threads is already reached.
Currently the pool does not destroy any thread he once created.
| Fields inherited from class java.lang.ThreadGroup |
daemon, destroyed, groups, maxPriority, name, ngroups, nthreads, parent, threads, vmAllowSuspension |
| Constructor Summary | |
ThreadPool(org.jdom.Element config)
Creates a thread pool. |
|
ThreadPool(int initPoolSize,
int maxPoolSize)
Creates a thread pool. |
|
ThreadPool(java.lang.String threadPoolName,
int initPoolSize,
int maxPoolSize)
Creates a thread pool. |
|
| Method Summary | |
void |
cancel(java.lang.Runnable work)
Try to stop a thread. |
void |
execute(java.lang.Runnable work)
Add work which will be eventually done by one of the threads in this pool. |
protected void |
finalize()
|
int |
getCurrentPoolSize()
Gets the number of threads in this pool. |
void |
resumePool()
resume a pool. |
void |
startPool()
Stop a pool. |
void |
stopPool()
Stop a pool. |
void |
suspendPool()
Suspend a pool. |
| Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, add, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, list, parentOf, remove, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public ThreadPool(org.jdom.Element config)
threadPoolName - the name of the thread poolinitPoolSize - the initial size of the thread poolmaxPoolSize - the maximum size of the thread poolthreadFactory - the factory to create the threads
public ThreadPool(java.lang.String threadPoolName,
int initPoolSize,
int maxPoolSize)
threadPoolName - the name of the thread poolinitPoolSize - the initial size of the thread poolmaxPoolSize - the maximum size of the thread poolthreadFactory - the factory to create the threads
public ThreadPool(int initPoolSize,
int maxPoolSize)
initPoolSize - the initial size of the thread poolmaxPoolSize - the maximum size of the thread poolthreadFactory - the factory to create the threads| Method Detail |
public void execute(java.lang.Runnable work)
throws ThreadPoolStoppedException
execute in interface IThreadPoolwork - the work to dopublic void cancel(java.lang.Runnable work)
cancel in interface IThreadPoolwork - the work to dopublic int getCurrentPoolSize()
getCurrentPoolSize in interface IThreadPoolpublic void stopPool()
stopPool in interface IThreadPoolpublic void startPool()
startPool in interface IThreadPoolpublic void suspendPool()
suspendPool in interface IThreadPoolpublic void resumePool()
resumePool in interface IThreadPool
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Object
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||