|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.jas.util.DistThreadPool
public class DistThreadPool
Distributed thread pool. Using stack / list workpile and Executable Channels and Servers.
Field Summary | |
---|---|
protected int |
idleworkers
Number of idle workers. |
protected java.util.LinkedList<java.lang.Runnable> |
jobstack
Work queue / stack. |
protected StrategyEnumeration |
strategy
|
protected int |
threads
Number of threads to use. |
protected edu.jas.util.DistPoolThread[] |
workers
Array of workers. |
Constructor Summary | |
---|---|
DistThreadPool()
Constructs a new DistThreadPool with strategy StrategyEnumeration.FIFO and size DEFAULT_SIZE. |
|
DistThreadPool(int size)
Constructs a new DistThreadPool with strategy StrategyEnumeration.FIFO. |
|
DistThreadPool(int size,
java.lang.String mfile)
Constructs a new DistThreadPool with strategy StrategyEnumeration.FIFO. |
|
DistThreadPool(StrategyEnumeration strategy)
Constructs a new DistThreadPool with size DEFAULT_SIZE. |
|
DistThreadPool(StrategyEnumeration strategy,
int size,
java.lang.String mfile)
Constructs a new DistThreadPool. |
Method Summary | |
---|---|
void |
addJob(java.lang.Runnable job)
adds a job to the workpile. |
ExecutableChannels |
getEC()
the used executable channel. |
protected java.lang.Runnable |
getJob()
get a job for processing. |
int |
getNumber()
number of worker threads. |
StrategyEnumeration |
getStrategy()
get used strategy. |
boolean |
hasJobs()
check if there are jobs for processing. |
boolean |
hasJobs(int n)
check if there are more than n jobs for processing. |
void |
init()
thread initialization and start. |
void |
terminate()
Terminates the threads. |
void |
terminate(boolean shutDown)
Terminates the threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int threads
protected edu.jas.util.DistPoolThread[] workers
protected int idleworkers
protected java.util.LinkedList<java.lang.Runnable> jobstack
protected StrategyEnumeration strategy
Constructor Detail |
---|
public DistThreadPool()
public DistThreadPool(StrategyEnumeration strategy)
strategy
- for job processing.public DistThreadPool(int size)
size
- of the pool.public DistThreadPool(int size, java.lang.String mfile)
size
- of the pool.mfile
- machine file.public DistThreadPool(StrategyEnumeration strategy, int size, java.lang.String mfile)
strategy
- for job processing.size
- of the pool.mfile
- machine file.Method Detail |
---|
public void init()
public int getNumber()
public StrategyEnumeration getStrategy()
public ExecutableChannels getEC()
public void terminate(boolean shutDown)
shutDown
- true, if shut-down of the remote executable servers is
requested, false, if remote executable servers stay alive.public void terminate()
public void addJob(java.lang.Runnable job)
job
- protected java.lang.Runnable getJob() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean hasJobs()
public boolean hasJobs(int n)
n
- Integer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |