|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.xmlrpc.util.ThreadPool
public class ThreadPool
Simple thread pool. A task is executed by obtaining a thread from the pool
| Nested Class Summary | |
|---|---|
static interface |
ThreadPool.InterruptableTask
A task, which may be interrupted, if the pool is shutting down. |
private class |
ThreadPool.Poolable
|
static interface |
ThreadPool.Task
The thread pool contains instances of ThreadPool.Task. |
| Field Summary | |
|---|---|
private int |
maxSize
|
private int |
num
|
private java.util.List |
runningThreads
|
private java.lang.ThreadGroup |
threadGroup
|
private java.util.List |
waitingTasks
|
private java.util.List |
waitingThreads
|
| Constructor Summary | |
|---|---|
ThreadPool(int pMaxSize,
java.lang.String pName)
Creates a new instance. |
|
| Method Summary | |
|---|---|
boolean |
addTask(ThreadPool.Task pTask)
Adds a task for immediate or deferred execution. |
(package private) void |
discard(ThreadPool.Poolable pPoolable)
|
int |
getMaxThreads()
Returns the maximum number of concurrent threads. |
int |
getNumThreads()
Returns the number of threads, which have actually been created, as opposed to the number of currently running threads. |
(package private) void |
repool(ThreadPool.Poolable pPoolable)
|
void |
shutdown()
Closes the pool. |
boolean |
startTask(ThreadPool.Task pTask)
Starts a task immediately. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final java.lang.ThreadGroup threadGroup
private final int maxSize
private final java.util.List waitingThreads
private final java.util.List runningThreads
private final java.util.List waitingTasks
private int num
| Constructor Detail |
|---|
public ThreadPool(int pMaxSize,
java.lang.String pName)
pMaxSize - Maximum number of concurrent threads.pName - Thread group name.| Method Detail |
|---|
void discard(ThreadPool.Poolable pPoolable)
void repool(ThreadPool.Poolable pPoolable)
public boolean startTask(ThreadPool.Task pTask)
pTask - The task being started.
addTask(Task) method instead.public boolean addTask(ThreadPool.Task pTask)
pTask - The task being added.
public void shutdown()
public int getMaxThreads()
public int getNumThreads()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||