Class ParallelPoolProcessing
java.lang.Object
de.uni_trier.wi2.procake.utils.concurrent.ParallelPoolProcessing
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Interface that holds the main method for every call to process an element from the case base. -
Constructor Summary
ConstructorDescriptionParallelPoolProcessing
(DataObject[] poolArr, int taskSize, boolean sortQueue) ParallelPoolProcessing
(ReadableObjectPool<DataObject> pool, int taskSize, boolean sortQueue) ParallelPoolProcessing
(ReadableObjectPool<DataObject> pool, int taskSize, boolean sortQueue, int numberOfWorkers) -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
int
boolean
void
process()
Main method that is called in order to start parallel processing of all cases in the case base.void
Main method that is called in order to start parallel processing of all cases in the case base.void
setSorting
(boolean sorting) void
setTaskSize
(int taskSize) void
Terminates all computations of the underlying thread pool.
-
Constructor Details
-
ParallelPoolProcessing
public ParallelPoolProcessing() -
ParallelPoolProcessing
-
ParallelPoolProcessing
public ParallelPoolProcessing(ReadableObjectPool<DataObject> pool, int taskSize, boolean sortQueue, int numberOfWorkers) -
ParallelPoolProcessing
-
-
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 callterminate()
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 ofprocess()
. 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 callterminate()
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
-