edu.stanford.rsl.konrad.parallel
Class ParallelThreadExecutor

java.lang.Object
  extended by edu.stanford.rsl.konrad.parallel.ParallelThreadExecutor

public class ParallelThreadExecutor
extends java.lang.Object

Class to execute multiple ParallelizeableRunnables in parallel. The Executor will dispatch as many ParallelizedRunnables as there are CPUs in the machine on which the code is executed in one batch. Then it will wait until all processes in the current batch are done. As soon as this is the case a new batch of processes is started. This is done until all ParallelizableRunnables are processed.

Author:
Andreas Maier

Constructor Summary
ParallelThreadExecutor(ParallelizableRunnable[] runnables)
          In order to have the threads performed in parallel just an Array of ParallelizableRunnables is passed to the contructor of the ParallelThreadExecutor.
ParallelThreadExecutor(ParallelizableRunnable[] runnables, int latchSize)
           
 
Method Summary
 void execute()
          This method will start the processing.
 boolean isShowStatus()
           
 void setShowStatus(boolean showStatus)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParallelThreadExecutor

public ParallelThreadExecutor(ParallelizableRunnable[] runnables)
In order to have the threads performed in parallel just an Array of ParallelizableRunnables is passed to the contructor of the ParallelThreadExecutor.

Parameters:
runnables - the processes to run.

ParallelThreadExecutor

public ParallelThreadExecutor(ParallelizableRunnable[] runnables,
                              int latchSize)
Method Detail

setShowStatus

public void setShowStatus(boolean showStatus)

isShowStatus

public boolean isShowStatus()

execute

public void execute()
             throws java.lang.InterruptedException
This method will start the processing.

Throws:
java.lang.InterruptedException - may occur.