Groovy Documentation

gpars.dataflow.operator
Class DataFlowOperator

java.lang.Object
  gpars.dataflow.operator.DataFlowOperator

class DataFlowOperator

Dataflow operators form the basic units in dataflow networks. Operators are typically combined into oriented graphs that transform data. They accept a set of input and output dataflow channels so that once values are available to be consumed in all the input channels the operator's body is triggered on the values, potentially generating values for the output channels. The output channels at the same time are suitable to be used as input channels by some other dataflow operators. The channels allow operators to communicate. Dataflow operators enable creation of highly concurrent applications yet the abstraction hides the low-level concurrency primitives and exposes much friendlier API. Since operators internally leverage the actor implementation, they reuse a pool of threads and so the actual number of threads used by the calculation can be kept much lower than the actual number of operators used in the network.

author:
Vaclav Pech Date: Sep 9, 2009


Constructor Summary
private DataFlowOperator(Map channels, groovy.lang.Closure code)

Creates an operator

 
Method Summary
void bindOutput(int idx, def value)

Used by the operator's body to send a value to the given output channel

void bindOutput(def value)

Used by the operator's body to send a value to the first / only output channel

def getOutput()

The operator's first / only output channel

def getOutputs(int idx)

The operator's output channel of the given index

def getOutputs()

The operator's output channel of the given index

void join()

Joins the operator waiting for it to finish

protected void reportError(Throwable e)

Is invoked in case the actor throws an exception.

DataFlowOperator start(PGroup group)

Starts an operator using the specified operator actor group

void stop()

Stops the operator

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Constructor Detail

DataFlowOperator

private DataFlowOperator(Map channels, groovy.lang.Closure code)
Creates an operator
param:
channels A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataFlowStream or DataFlowVariable classes) to use for inputs and outputs
param:
code The operator's body to run each time all inputs have a value to read


 
Method Detail

bindOutput

void bindOutput(int idx, def value)
Used by the operator's body to send a value to the given output channel


bindOutput

void bindOutput(def value)
Used by the operator's body to send a value to the first / only output channel


getOutput

public def getOutput()
The operator's first / only output channel


getOutputs

public def getOutputs(int idx)
The operator's output channel of the given index


getOutputs

public def getOutputs()
The operator's output channel of the given index


join

public void join()
Joins the operator waiting for it to finish


reportError

protected void reportError(Throwable e)
Is invoked in case the actor throws an exception.


start

DataFlowOperator start(PGroup group)
Starts an operator using the specified operator actor group
param:
group The operator actor group to use with the operator


stop

public void stop()
Stops the operator


 

Groovy Documentation