org.codehaus.gpars

groovyx.gpars.forkjoin
Class AbstractForkJoinWorker

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

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.Collection children

Stores the child workers

 
Constructor Summary
protected AbstractForkJoinWorker()

 
Method Summary
protected T compute()

protected T 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.Collection children
Stores the child workers


 
Constructor Detail

AbstractForkJoinWorker

protected AbstractForkJoinWorker()


 
Method Detail

compute

@Override
protected final T compute()


computeTask

protected T 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

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–2010 Václav Pech. All Rights Reserved.