groovyx.gpars.forkjoin
Class AbstractForkJoinWorker<T>
java.lang.Object
jsr166y.forkjoin.ForkJoinTask<V>
jsr166y.forkjoin.RecursiveTask<T>
groovyx.gpars.forkjoin.AbstractForkJoinWorker<T>
- Direct Known Subclasses:
- FJWorker
public abstract class AbstractForkJoinWorker<T>
- extends jsr166y.forkjoin.RecursiveTask<T>
Implements the ForkJoin worker contract.
Subclasses need to implement the compute() to perform the actual Fork/Join algorithm leveraging the options
provided by the AbstractForkJoinWorker class. The AbstractForJoinWorker class takes care of the child sub-processes.
Author: Vaclav Pech
Date: Nov 1, 2009
Methods inherited from class jsr166y.forkjoin.RecursiveTask |
exec, finish, finishExceptionally, forkJoin, rawResult, reinitialize |
Methods inherited from class jsr166y.forkjoin.ForkJoinTask |
cancel, fork, getException, isCancelled, isDone, isStolen, join, quietlyJoin |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
children
private java.util.Collection<AbstractForkJoinWorker<T>> children
- Stores the child workers
AbstractForkJoinWorker
protected AbstractForkJoinWorker()
compute
protected final T compute()
- Specified by:
compute
in class jsr166y.forkjoin.RecursiveTask<T>
computeTask
protected abstract T computeTask()
forkOffChild
protected final void forkOffChild(AbstractForkJoinWorker<T> child)
- Forks a child task. Makes sure it has a means to indicate back completion.
The worker is stored in the internal list of workers for evidence and easy result retrieval through getChildrenResults().
- Parameters:
child
- The child task
getChildrenResults
public final java.util.List<T> getChildrenResults()
- Waits for and returns the results of the child tasks.
- Returns:
- A list of results returned from the child tasks