Class ParallelPoolProcessing

java.lang.Object
de.uni_trier.wi2.procake.utils.concurrent.ParallelPoolProcessing

public class ParallelPoolProcessing extends Object
This class is intended to be used to process elements of a case base in parallel across multiple threads. Therefore, it is specified by the using class which task should be executed on every element of the case base.
  • Constructor Details

    • ParallelPoolProcessing

      public ParallelPoolProcessing()
    • ParallelPoolProcessing

      public ParallelPoolProcessing(ReadableObjectPool<DataObject> pool, int taskSize, boolean sortQueue)
    • ParallelPoolProcessing

      public ParallelPoolProcessing(ReadableObjectPool<DataObject> pool, int taskSize, boolean sortQueue, int numberOfWorkers)
    • ParallelPoolProcessing

      public ParallelPoolProcessing(DataObject[] poolArr, int taskSize, boolean sortQueue)
  • Method Details

    • processAndWait

      public void processAndWait()
      Main method that is called in order to start parallel processing of all cases in the case base. It starts all workers. The method does block the main thread. It is not required to call terminate() to finish all computations of the thread pool.
    • terminate

      public void terminate()
      Terminates all computations of the underlying thread pool. This methof has to be called after a prior call of process(). In contrast, processAndWait() automatically blocks until all computations have finished.
    • process

      public void process()
      Main method that is called in order to start parallel processing of all cases in the case base. It starts all workers. The method does not block the main thread. It is required to call terminate() at a certain point to finish all computations of the thread pool.
    • getTaskSize

      public int getTaskSize()
    • setTaskSize

      public void setTaskSize(int taskSize)
    • isSorting

      public boolean isSorting()
    • setSorting

      public void setSorting(boolean sorting)
    • getNumberOfWorkers

      public int getNumberOfWorkers()
    • addProcessingTask

      public void addProcessingTask(ParallelPoolProcessing.ProcessingTask task)