|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.jonas_ejb.container.ThreadPool
This is a generic Thread Pool. It manages an ArrayList of Runnable Each thread picks one to run it and loop on the next.
Nested Class Summary | |
protected class |
ThreadPool.ServerThread
This Thread loops executing runnables added in the pool |
Field Summary | |
static int |
DEFAULT_POOL_MAX_SIZE
|
static int |
DEFAULT_POOL_MIN_SIZE
|
protected int |
maxpoolsz
|
protected static int |
poolnumber
|
protected int |
poolsz
|
protected java.util.ArrayList |
runnablelist
|
protected boolean |
valid
|
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()
|
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 |
Field Detail |
public static final int DEFAULT_POOL_MIN_SIZE
public static final int DEFAULT_POOL_MAX_SIZE
protected static int poolnumber
protected int poolsz
protected int maxpoolsz
protected java.util.ArrayList runnablelist
protected boolean valid
Constructor Detail |
public ThreadPool()
public ThreadPool(int size)
size
- thread number to start the pool with.public ThreadPool(int minsz, int maxsz)
minsz
- thread number to start the pool with.maxsz
- maximum nb of threads in the poolMethod Detail |
public void addRunnable(java.lang.Runnable runner)
runner
- The runnable objectpublic java.lang.Runnable nextRunnable()
public void stopThreads()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |