gr.demokritos.iit.jinsect.threading
Class PooledThreadList

java.lang.Object
  extended by gr.demokritos.iit.jinsect.threading.ThreadQueue
      extended by gr.demokritos.iit.jinsect.threading.ThreadList
          extended by gr.demokritos.iit.jinsect.threading.PooledThreadList

public class PooledThreadList
extends ThreadList


Field Summary
protected  boolean bShouldTerminate
           
 
Fields inherited from class gr.demokritos.iit.jinsect.threading.ThreadQueue
Max, qThreads
 
Constructor Summary
PooledThreadList(int nThreads)
           
 
Method Summary
 boolean addThreadFor(java.lang.Runnable r)
          Adds a Runnable object in the list for execution, if possible.
 void terminateThreads()
           
 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

bShouldTerminate

protected boolean bShouldTerminate
Constructor Detail

PooledThreadList

public PooledThreadList(int nThreads)
Method Detail

addThreadFor

public boolean addThreadFor(java.lang.Runnable r)
Description copied from class: ThreadList
Adds a Runnable object in the list for execution, if possible. There is no first-in, first-out logic, as opposed to ThreadQueue.

Overrides:
addThreadFor in class ThreadList
Parameters:
r - The runnable object to execute.
Returns:
True if the object was queued for execution, or false if the queue was full.

waitUntilCompletion

public void waitUntilCompletion()
                         throws java.lang.InterruptedException
Description copied from class: ThreadQueue
Waits until all running threads have been complete.

Overrides:
waitUntilCompletion in class ThreadQueue
Throws:
java.lang.InterruptedException

terminateThreads

public void terminateThreads()
                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException