Classes | |
| interface | InterruptableTask |
| class | Poolable |
| interface | Task |
Public Member Functions | |
| boolean | addTask (Task pTask) |
| int | getMaxThreads () |
| synchronized int | getNumThreads () |
| synchronized void | shutdown () |
| boolean | startTask (Task pTask) |
| ThreadPool (int pMaxSize, String pName) | |
Package Functions | |
| void | repool (Poolable pPoolable) |
Private Member Functions | |
| synchronized Poolable | getPoolable (Task pTask, boolean pQueue) |
| synchronized void | remove (Poolable pPoolable) |
Private Attributes | |
| final int | maxSize |
| int | num |
| final List | runningThreads = new ArrayList() |
| final ThreadGroup | threadGroup |
| final List | waitingTasks = new ArrayList() |
| final List | waitingThreads = new ArrayList() |
Simple thread pool. A task is executed by obtaining a thread from the pool
Definition at line 28 of file ThreadPool.java.
| org.apache.xmlrpc.util.ThreadPool.ThreadPool | ( | int | pMaxSize, |
| String | pName | ||
| ) | [inline] |
Creates a new instance.
| pMaxSize | Maximum number of concurrent threads. |
| pName | Thread group name. |
Definition at line 123 of file ThreadPool.java.
| boolean org.apache.xmlrpc.util.ThreadPool.addTask | ( | Task | pTask | ) | [inline] |
Adds a task for immediate or deferred execution.
| pTask | The task being added. |
Definition at line 201 of file ThreadPool.java.
| int org.apache.xmlrpc.util.ThreadPool.getMaxThreads | ( | ) | [inline] |
Returns the maximum number of concurrent threads.
Definition at line 226 of file ThreadPool.java.
| synchronized int org.apache.xmlrpc.util.ThreadPool.getNumThreads | ( | ) | [inline] |
Returns the number of threads, which have actually been created, as opposed to the number of currently running threads.
Definition at line 231 of file ThreadPool.java.
| synchronized Poolable org.apache.xmlrpc.util.ThreadPool.getPoolable | ( | Task | pTask, |
| boolean | pQueue | ||
| ) | [inline, private] |
Definition at line 178 of file ThreadPool.java.
| synchronized void org.apache.xmlrpc.util.ThreadPool.remove | ( | Poolable | pPoolable | ) | [inline, private] |
Definition at line 128 of file ThreadPool.java.
| void org.apache.xmlrpc.util.ThreadPool.repool | ( | Poolable | pPoolable | ) | [inline, package] |
Definition at line 133 of file ThreadPool.java.
| synchronized void org.apache.xmlrpc.util.ThreadPool.shutdown | ( | ) | [inline] |
Closes the pool.
Definition at line 212 of file ThreadPool.java.
| boolean org.apache.xmlrpc.util.ThreadPool.startTask | ( | Task | pTask | ) | [inline] |
Starts a task immediately.
| pTask | The task being started. |
Definition at line 169 of file ThreadPool.java.
final int org.apache.xmlrpc.util.ThreadPool.maxSize [private] |
Definition at line 112 of file ThreadPool.java.
int org.apache.xmlrpc.util.ThreadPool.num [private] |
Definition at line 116 of file ThreadPool.java.
final List org.apache.xmlrpc.util.ThreadPool.runningThreads = new ArrayList() [private] |
Definition at line 114 of file ThreadPool.java.
final ThreadGroup org.apache.xmlrpc.util.ThreadPool.threadGroup [private] |
Definition at line 111 of file ThreadPool.java.
final List org.apache.xmlrpc.util.ThreadPool.waitingTasks = new ArrayList() [private] |
Definition at line 115 of file ThreadPool.java.
final List org.apache.xmlrpc.util.ThreadPool.waitingThreads = new ArrayList() [private] |
Definition at line 113 of file ThreadPool.java.