org.objectweb.jonas_ejb.container
Class ThreadPool
java.lang.Object
|
+--org.objectweb.jonas_ejb.container.ThreadPool
- public class ThreadPool
- extends java.lang.Object
This is a generic Thread Pool. It manages an ArrayList of Runnable
Each thread picks one to run it and loop on the next.
Constructor Summary |
ThreadPool()
Create a pool with default values |
ThreadPool(int size)
Create a pool with a number of threads pre allocated |
ThreadPool(int minsz,
int maxsz)
Create a pool with a minimum and a maximum values for thread number. |
Method Summary |
void |
addRunnable(java.lang.Runnable runner)
Add a Runnable in the pool, ready to be run. |
java.lang.Runnable |
nextRunnable()
Get the next Runnable to be run |
void |
stopThreads()
Pool is removed: Stop all threads |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_POOL_MIN_SIZE
protected static final int DEFAULT_POOL_MIN_SIZE
DEFAULT_POOL_MAX_SIZE
protected static final int DEFAULT_POOL_MAX_SIZE
poolnumber
protected static int poolnumber
poolsz
protected int poolsz
maxpoolsz
protected int maxpoolsz
runnablelist
protected java.util.ArrayList runnablelist
valid
protected boolean valid
ThreadPool
public ThreadPool()
- Create a pool with default values
ThreadPool
public ThreadPool(int size)
- Create a pool with a number of threads pre allocated
ThreadPool
public ThreadPool(int minsz,
int maxsz)
- Create a pool with a minimum and a maximum values for thread number.
addRunnable
public void addRunnable(java.lang.Runnable runner)
- Add a Runnable in the pool, ready to be run.
nextRunnable
public java.lang.Runnable nextRunnable()
- Get the next Runnable to be run
stopThreads
public void stopThreads()
- Pool is removed: Stop all threads