org.apache.xmlrpc.util
public class ThreadPool extends Object
Nested Class Summary | |
---|---|
interface | ThreadPool.Task The thread pool contains instances of {@link ThreadPool.Task}. |
Constructor Summary | |
---|---|
ThreadPool(int pMaxSize, String pName) Creates a new instance. |
Method Summary | |
---|---|
boolean | addTask(ThreadPool.Task pTask) Adds a task for immediate or deferred execution. |
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. |
void | shutdown() Closes the pool. |
boolean | startTask(ThreadPool.Task pTask) Starts a task immediately. |
Parameters: pMaxSize Maximum number of concurrent threads. pName Thread group name.
Parameters: pTask The task being added.
Returns: True, if the task was started immediately. False, if the task will be executed later.
Returns: Maximum number of threads.
Parameters: pTask The task being started.
Returns: True, if the task could be started immediately. False, if the maxmimum number of concurrent tasks was exceeded. If so, you might consider to use the {@link #addTask(Task)} method instead.