public class ThreadPool extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ThreadPool.InterruptableTask
A task, which may be interrupted, if the pool is shutting down.
|
static interface |
ThreadPool.Task
The thread pool contains instances of
ThreadPool.Task. |
| Constructor and Description |
|---|
ThreadPool(int pMaxSize,
String pName)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addTask(ThreadPool.Task pTask)
Deprecated.
No longer in use.
|
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.
|
public ThreadPool(int pMaxSize,
String pName)
pMaxSize - Maximum number of concurrent threads.pName - Thread group name.public boolean startTask(ThreadPool.Task pTask)
pTask - The task being started.addTask(ThreadPool.Task) method instead.public boolean addTask(ThreadPool.Task pTask)
pTask - The task being added.public void shutdown()
public int getMaxThreads()
public int getNumThreads()
Copyright © 2001–2025 The Apache Software Foundation. All rights reserved.