|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgr.demokritos.iit.jinsect.threading.ThreadQueue
public class ThreadQueue
A queue of threads for parallel execution.
Should probably be replaced by ThreadPoolExecutor
.
Field Summary | |
---|---|
protected int |
Max
The maximum number of running threads. |
protected java.util.Queue |
qThreads
The queue of threads. |
Constructor Summary | |
---|---|
ThreadQueue()
Initializes a thread queue, with the default maximum number of threads running at the same time. |
|
ThreadQueue(int iMax)
Initializes a thread queue, with a given maximum of threads running at the same time. |
Method Summary | |
---|---|
boolean |
addThreadFor(java.lang.Runnable r)
Adds a Runnable object in the queue for execution, if possible. |
void |
waitUntilCompletion()
Waits until all running threads have been complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Queue qThreads
protected int Max
Constructor Detail |
---|
public ThreadQueue()
public ThreadQueue(int iMax)
iMax
- The maximum number of threads running at the same time.Method Detail |
---|
public boolean addThreadFor(java.lang.Runnable r)
Runnable
object in the queue for execution, if possible. First-in,
first-out logic is followed.
r
- The runnable object to execute.
public void waitUntilCompletion() throws java.lang.InterruptedException
java.lang.InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |