Method Summary |
|
public synchronized void | cancel() Cancels all threads non-blocking by interrupting them. |
public static ThreadPool | create(String name, int size) Creates a thread pool with the supplied name and size.
Parameters: name - the name prefix for the threads in this pool. Parameters: size - the number of threads in this pool. |
public synchronized void | execute(WorkerTask task) Executes a task on behalf of this thread pool. |
public String | getName() Returns the name of the thread pool. |
protected String | getTaskManagerName(String prefix, int index) |
public synchronized void | interrupt() Interrupts all threads in the pool. |
public synchronized boolean | isIdle() Checks if all threads of the pool are idle. |
public boolean | isRespawnThreads() Tests if the threads are respawn (recreates) when they have been stopped
or canceled. |
public void | setRespawnThreads(boolean respawnThreads) Specifies whether threads are respawned by this thread pool after they
have been stopped or not. |
protected void | setup(String name, int size) |
public void | stop() Stops all threads in this thread pool gracefully. |
public synchronized boolean | tryToExecute(WorkerTask task) Tries to execute a task on behalf of this thread pool. |