|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xlattice.util.threads.ThreadList
public class ThreadList
A fixed-size list of Killables, Threads which can run jobs for us. This class is not thread-safe. All external calls should be synchronized on the class instance. XXX BAD IDEA: this class should be made thread-safe. XXX ERROR: removing a Thread doesn't affect the busy count!
| Field Summary | |
|---|---|
static int |
MIN_CAPACITY
|
| Constructor Summary | |
|---|---|
ThreadList(int n)
|
|
| Method Summary | |
|---|---|
void |
add(Killable o)
Add a thread to the lit. |
boolean |
allBusy()
Is everyone busy? |
boolean |
allIdle()
Is everyone idle? |
int |
capacity()
|
void |
die()
Mark all list members as dying. |
void |
endJob()
Decrease busy count. |
Killable |
pop()
Remove last object from list. |
boolean |
remove(Killable o)
Remove a specific item from the list. |
int |
size()
|
void |
startJob()
Increase busy count. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MIN_CAPACITY
| Constructor Detail |
|---|
public ThreadList(int n)
n - list capacity; at least MIN_CAPACITY| Method Detail |
|---|
public void startJob()
public void endJob()
public boolean allBusy()
public boolean allIdle()
public void add(Killable o)
public int capacity()
public void die()
public int size()
public Killable pop()
public boolean remove(Killable o)
o - the object to be removed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||