| java.lang.Object org.jboss.mx.util.ThreadPool
ThreadPool | public class ThreadPool (Code) | | A simple thread pool. Idle threads are cached for future use.
The cache grows until it reaches a maximum size (default 10).
When there is nothing in the cache, a new thread is created.
By default the threads are daemon threads.
Rickard \u00d6berg
Adrian Brock
version: $Revision: 57200 $ |
Inner Class :class Worker extends Thread | |
Method Summary | |
public boolean | getDaemonThreads() Get whether new threads are daemon threads. | public int | getMaximumSize() Get the maximum number of idle threads cached in this pool. | public boolean | isActive() Get the activity status of the pool. | public synchronized void | run(Runnable work) Do some work. | public void | setActive(boolean status) Set the activity status of the pool. | public void | setDaemonThreads(boolean value) Set whether new threads are daemon threads. | public void | setMaximumSize(int size) Set the maximum number of idle threads cached in this pool. |
ThreadPool | public ThreadPool()(Code) | | Create a new pool.
|
ThreadPool | public ThreadPool(boolean active)(Code) | | Create a new pool with an activity status
Parameters: active - true for active, false otherwise |
getDaemonThreads | public boolean getDaemonThreads()(Code) | | Get whether new threads are daemon threads.
true for daemon threads, false otherwise. |
getMaximumSize | public int getMaximumSize()(Code) | | Get the maximum number of idle threads cached in this pool.
the maximum size |
isActive | public boolean isActive()(Code) | | Get the activity status of the pool.
true for an active pool, false otherwise. |
run | public synchronized void run(Runnable work)(Code) | | Do some work.
This will either create a new thread to do the work, or
use an existing idle cached thread.
Parameters: work - the work to perform. |
setActive | public void setActive(boolean status)(Code) | | Set the activity status of the pool. Setting the pool to
inactive, clears the pool.
Parameters: status - pass true for active, false otherwise. |
setDaemonThreads | public void setDaemonThreads(boolean value)(Code) | | Set whether new threads are daemon threads.
Parameters: value - pass true for daemon threads, false otherwise. |
setMaximumSize | public void setMaximumSize(int size)(Code) | | Set the maximum number of idle threads cached in this pool.
Parameters: size - the new maximum size. |
|
|