Dataflow selectors and operators (processors) form the basic units in dataflow networks. They 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 to be written into the output channels. The output channels at the same time are suitable to be used as input channels by some other dataflow processors. The channels allow processors to communicate.
Dataflow selectors and operators enable creation of highly concurrent applications yet the abstraction hides the low-level concurrency primitives and exposes much friendlier API. Since selectors and 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 processors used in the network.
Fields inherited from class | Fields |
---|---|
class DataflowProcessor |
INPUTS, LISTENERS, MAX_FORKS, OUTPUTS, STATE_OBJECT, actor, listeners, stateObject |
Constructor and description |
---|
DataflowOperator
(PGroup group, java.util.Map channels, groovy.lang.Closure code) Creates an operator After creation the operator needs to be started using the start() method. |
Type | Name and description |
---|---|
private static java.lang.String |
countInputChannels(java.util.Map channels) |
private static boolean |
verifyChannelParameters(java.util.Map channels, int parameters, java.lang.Class[] parameterTypes) |
Methods inherited from class | Name |
---|---|
class DataflowProcessor |
addDataflowEventListener, bindAllOutputValues, bindAllOutputValuesAtomically, bindAllOutputs, bindAllOutputsAtomically, bindOutput, bindOutput, checkMaxForks, extractInputs, extractListeners, extractOutputs, extractState, fireAfterRun, fireAfterStart, fireAfterStop, fireBeforeRun, fireControlMessageArrived, fireCustomEvent, fireMessageArrived, fireMessageSentOut, fireOnException, getOutput, getOutputs, getOutputs, getStateObject, join, registerChannelListenersToAllInputs, removeDataflowEventListener, reportError, shouldBeMultiThreaded, start, start, terminate, terminateAfterNextRun |
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Creates an operator After creation the operator needs to be started using the start() method.
group
- The group the thread pool of which o usechannels
- A map specifying "inputs" and "outputs" - dataflow channels (instances of the DataflowQueue or DataflowVariable classes) to use for inputs and outputscode
- The operator's body to run each time all inputs have a value to readCopyright © 2008–2014 Václav Pech. All Rights Reserved.