public class ThreadPool extends Object implements IThreadPool
Modifier and Type | Class and Description |
---|---|
class |
ThreadPool.ServiceThread
A service thread executes tasks.
|
Modifier and Type | Field and Description |
---|---|
static long |
PRINT_DELAY
Print every 10 seconds.
|
static boolean |
PROFILING
Enable call profiling.
|
Constructor and Description |
---|
ThreadPool()
Create a new thread pool.
|
ThreadPool(boolean daemon,
IPoolStrategy strategy)
Create a new thread pool.
|
ThreadPool(boolean daemon,
IPoolStrategy strategy,
long maxwait)
Create a new thread pool.
|
ThreadPool(IPoolStrategy strategy)
Create a new thread pool.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Shutdown the task pool
|
void |
execute(Runnable task)
Execute a task in its own thread.
|
boolean |
isRunning()
Test if the thread pool is running.
|
static void |
main(String[] args)
Main for testing.
|
String |
toString()
Get the string representation.
|
public static final boolean PROFILING
public static final long PRINT_DELAY
public ThreadPool()
public ThreadPool(IPoolStrategy strategy)
public ThreadPool(boolean daemon, IPoolStrategy strategy)
public ThreadPool(boolean daemon, IPoolStrategy strategy, long maxwait)
public boolean isRunning()
isRunning
in interface IThreadPool
public void execute(Runnable task)
execute
in interface IThreadPool
task
- The task to execute.public void dispose()
dispose
in interface IThreadPool
public String toString()
public static void main(String[] args)
args
- The arguments.Copyright © 2013. All Rights Reserved.