|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xlattice.util.threads.ThreadPool
public class ThreadPool
Fixed size pool of Killable threads which consume a (possibly variable in size) queue of Killable jobs, Runnables with a die() method. XXX Modify to allow change in pool capacity.
Field Summary | |
---|---|
protected boolean |
daemon
|
protected JobQueue |
jobQ
we synchronize access to this |
protected int |
maxLenJobQ
If -1, length varies dynamically with no specific max; otherwise, rejects jobs if max queue length exceeded. |
protected int |
maxThreads
|
protected java.lang.String |
name
|
protected java.lang.ThreadGroup |
threadGroup
|
protected ThreadList |
workers
we synchronize access to this |
Constructor Summary | |
---|---|
ThreadPool(java.lang.String s,
int maxP)
Create a thread pool with a default queue size of 128 and using a default ThreadGroup |
|
ThreadPool(java.lang.String s,
int maxP,
int maxJ,
java.lang.ThreadGroup tg,
boolean b)
Create a thread pool, making up a default name if necessary. |
|
ThreadPool(java.lang.String s,
int maxP,
java.lang.ThreadGroup tg)
Create a thread group with a default queue size of 128 |
Method Summary | |
---|---|
boolean |
accept(java.lang.Runnable job)
Accept a Runnable into the job queue. |
int |
getMaxLenJobQueue()
|
int |
getMaxThreads()
|
java.lang.String |
getName()
|
int |
size()
|
void |
stop()
XXX Doesn't actually wait for worker threads to stop running. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String name
protected final java.lang.ThreadGroup threadGroup
protected final int maxThreads
protected final ThreadList workers
protected final int maxLenJobQ
protected final JobQueue jobQ
protected final boolean daemon
Constructor Detail |
---|
public ThreadPool(java.lang.String s, int maxP)
public ThreadPool(java.lang.String s, int maxP, java.lang.ThreadGroup tg)
public ThreadPool(java.lang.String s, int maxP, int maxJ, java.lang.ThreadGroup tg, boolean b)
s
- name of thread pool, base for thread namesmaxP
- maximum number of idle threads in poolmaxJ
- maximum number of jobs in the queuetg
- thread group threads will belong toMethod Detail |
---|
public java.lang.String getName()
public int getMaxLenJobQueue()
public int getMaxThreads()
public int size()
public boolean accept(java.lang.Runnable job)
public void stop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |