Package se.hb.jcp.util
Class ParallelizedAction
- java.lang.Object
-
- java.util.concurrent.ForkJoinTask<java.lang.Void>
-
- java.util.concurrent.RecursiveAction
-
- se.hb.jcp.util.ParallelizedAction
-
- All Implemented Interfaces:
java.io.Serializable,java.util.concurrent.Future<java.lang.Void>
public abstract class ParallelizedAction extends java.util.concurrent.RecursiveActionBase class for parallel actions over contiguous int intervals.- Author:
- anders.gidenstam(at)hb.se
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ParallelizedAction(int first, int last)Constructs a set of actions for the interval [first, last).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcompute()Inherited from RecursiveAction.protected abstract voidcompute(int i)The action to be performed for index i.protected abstract ParallelizedActioncreateSubtask(int first, int last)Creates a ParallelizedAction for the sub-interval.protected voidfinalize(int first, int last)Performs any needed finalization for the sub-interval once all sequential compute(i) calls for it has been completed.protected voidinitialize(int first, int last)Performs any needed intialization for the sub-interval once the split threshold has been reached.voidstart()Starts this set of actions.-
Methods inherited from class java.util.concurrent.ForkJoinTask
adapt, adapt, adapt, cancel, compareAndSetForkJoinTaskTag, complete, completeExceptionally, fork, get, get, getException, getForkJoinTaskTag, getPool, getQueuedTaskCount, getSurplusQueuedTaskCount, helpQuiesce, inForkJoinPool, invoke, invokeAll, invokeAll, invokeAll, isCancelled, isCompletedAbnormally, isCompletedNormally, isDone, join, peekNextLocalTask, pollNextLocalTask, pollSubmission, pollTask, quietlyComplete, quietlyInvoke, quietlyJoin, reinitialize, setForkJoinTaskTag, tryUnfork
-
-
-
-
Method Detail
-
start
public void start()
Starts this set of actions.
-
initialize
protected void initialize(int first, int last)Performs any needed intialization for the sub-interval once the split threshold has been reached. E.g. allocating buffers that can be reused by the sequential compute(i) calls in this task.- Parameters:
first- the first index in the sub-intervallast- the index after the last index in the sub-interval
-
finalize
protected void finalize(int first, int last)Performs any needed finalization for the sub-interval once all sequential compute(i) calls for it has been completed.- Parameters:
first- the first index in the sub-intervallast- the index after the last index in the sub-interval
-
compute
protected abstract void compute(int i)
The action to be performed for index i.- Parameters:
i- the index in the interval
-
createSubtask
protected abstract ParallelizedAction createSubtask(int first, int last)
Creates a ParallelizedAction for the sub-interval.- Parameters:
first- the first index in the sub-intervallast- the index after the last index in the sub-interval- Returns:
- a new subtask in the form of a ParallelizedAction.
-
compute
protected final void compute()
Inherited from RecursiveAction. Do not overrride.- Specified by:
computein classjava.util.concurrent.RecursiveAction
-
-