org.apache.xmlrpc.util
Class ThreadPool
java.lang.Object
org.apache.xmlrpc.util.ThreadPool
public class ThreadPool
extends java.lang.Object
Simple thread pool. A task is executed by obtaining a thread from
the pool
ThreadPool(int pMaxSize, String pName) - Creates a new instance.
|
ThreadPool
public ThreadPool(int pMaxSize,
String pName)
Creates a new instance.
pMaxSize
- Maximum number of concurrent threads.pName
- Thread group name.
addTask
public boolean addTask(ThreadPool.Task pTask)
Adds a task for immediate or deferred execution.
pTask
- The task being added.
- True, if the task was started immediately. False, if
the task will be executed later.
getMaxThreads
public int getMaxThreads()
Returns the maximum number of concurrent threads.
- Maximum number of threads.
getNumThreads
public int getNumThreads()
Returns the number of threads, which have actually been created,
as opposed to the number of currently running threads.
shutdown
public void shutdown()
Closes the pool.
startTask
public boolean startTask(ThreadPool.Task pTask)
Starts a task immediately.
pTask
- The task being started.
- 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
addTask(ThreadPool.Task)
method instead.
Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.