org.codehaus.gpars

groovyx.gpars.forkjoin
[Java] Class AbstractForkJoinWorker

java.lang.Object
  jsr166y.RecursiveTask
      groovyx.gpars.forkjoin.AbstractForkJoinWorker

public abstract class AbstractForkJoinWorker
extends RecursiveTask

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


Field Summary
private java.util.List children

Stores the child workers

 
Constructor Summary
protected AbstractForkJoinWorker()

 
Method Summary
protected java.lang.Object compute()

protected java.lang.Object computeTask()

protected void forkOffChild(AbstractForkJoinWorker child)

Forks a child task.

java.util.List getChildrenResults()

Waits for and returns the results of the child tasks.

 

Field Detail

children

private java.util.List children
Stores the child workers


 
Constructor Detail

AbstractForkJoinWorker

protected AbstractForkJoinWorker()


 
Method Detail

compute

@Override
protected final java.lang.Object compute()


computeTask

protected java.lang.Object computeTask()


forkOffChild

protected final void forkOffChild(AbstractForkJoinWorker 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

@SuppressWarnings({"unchecked"})
public final java.util.List getChildrenResults()
Waits for and returns the results of the child tasks.
Returns:
A list of results returned from the child tasks


 

Copyright © 2008–2012 Václav Pech. All Rights Reserved.