|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.operator.DataflowProcessor
@java.lang.SuppressWarnings* May hold custom state provided at construction time and read within the body public abstract class DataflowProcessor
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 and following specific strategies they transform input values from the input channels into new values written to 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.
Field Summary | |
---|---|
static java.lang.String |
INPUTS
|
private static java.lang.String |
LISTENERS
|
static java.lang.String |
MAX_FORKS
|
static java.lang.String |
OUTPUTS
|
static java.lang.String |
STATE_OBJECT
|
protected DataflowProcessorActor |
actor
|
protected java.util.Collection |
listeners
|
protected java.lang.Object |
stateObject
|
Constructor Summary | |
protected DataflowProcessor(java.util.Map channels, groovy.lang.Closure code)
|
Method Summary | |
---|---|
void
|
addDataflowEventListener(DataflowEventListener listener)
Registers the provided handler to all input channels |
void
|
bindAllOutputValues(java.lang.Object... values)
Used by the processor's body to send a value to all output channels, while guaranteeing atomicity of the operation and preventing other calls to bindAllOutputsAtomically() from interfering with one another. |
void
|
bindAllOutputValuesAtomically(java.lang.Object... values)
|
void
|
bindAllOutputs(java.lang.Object value)
|
void
|
bindAllOutputsAtomically(java.lang.Object value)
Used by the processor's body to send a value to all output channels, while guaranteeing atomicity of the operation and preventing other calls to bindAllOutputsAtomically() from interfering with one another. |
void
|
bindOutput(int idx, java.lang.Object value)
|
void
|
bindOutput(java.lang.Object value)
|
protected static void
|
checkMaxForks(java.util.Map channels)
|
static java.util.List
|
extractInputs(java.util.Map channels)
|
private static java.util.Collection
|
extractListeners(java.util.Map channels)
|
static java.util.List
|
extractOutputs(java.util.Map channels)
|
private static java.lang.Object
|
extractState(java.util.Map channels)
|
protected void
|
fireAfterRun(java.util.List messages)
|
protected void
|
fireAfterStart()
|
protected void
|
fireAfterStop()
|
protected java.util.List
|
fireBeforeRun(java.util.List messages)
|
protected java.lang.Object
|
fireControlMessageArrived(DataflowReadChannel channel, int index, java.lang.Object message)
|
java.lang.Object
|
fireCustomEvent(java.lang.Object data)
|
protected java.lang.Object
|
fireMessageArrived(DataflowReadChannel channel, int index, java.lang.Object message)
|
protected java.lang.Object
|
fireMessageSentOut(DataflowWriteChannel channel, int index, java.lang.Object message)
|
protected boolean
|
fireOnException(java.lang.Throwable e)
|
DataflowWriteChannel
|
getOutput()
|
DataflowWriteChannel
|
getOutputs(int idx)
|
java.util.List
|
getOutputs()
|
java.lang.Object
|
getStateObject()
|
void
|
join()
|
void
|
registerChannelListenersToAllInputs(DataflowChannelListener handler)
|
void
|
removeDataflowEventListener(DataflowEventListener listener)
|
void
|
reportError(java.lang.Throwable e)
|
static boolean
|
shouldBeMultiThreaded(java.util.Map channels)
|
DataflowProcessor
|
start(PGroup group)
Starts a processor using the specified parallel group |
DataflowProcessor
|
start()
Stops the processor immediately, potentially loosing unhandled messages |
void
|
terminate()
|
void
|
terminateAfterNextRun()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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() |
Field Detail |
---|
public static final java.lang.String INPUTS
private static final java.lang.String LISTENERS
public static final java.lang.String MAX_FORKS
public static final java.lang.String OUTPUTS
public static final java.lang.String STATE_OBJECT
protected DataflowProcessorActor actor
protected final java.util.Collection listeners
protected final java.lang.Object stateObject
Constructor Detail |
---|
protected DataflowProcessor(java.util.Map channels, groovy.lang.Closure code)
Method Detail |
---|
public final void addDataflowEventListener(DataflowEventListener listener)
handler
- The closure to invoke whenever a value gets bound to any of the input channels
public final void bindAllOutputValues(java.lang.Object... values)
value
- The value to bind
public final void bindAllOutputValuesAtomically(java.lang.Object... values)
public final void bindAllOutputs(java.lang.Object value)
public final void bindAllOutputsAtomically(java.lang.Object value)
values
- Values to send to output channels of the same position index
public final void bindOutput(int idx, java.lang.Object value)
public final void bindOutput(java.lang.Object value)
protected static void checkMaxForks(java.util.Map channels)
static java.util.List extractInputs(java.util.Map channels)
private static java.util.Collection extractListeners(java.util.Map channels)
static java.util.List extractOutputs(java.util.Map channels)
private static java.lang.Object extractState(java.util.Map channels)
protected final void fireAfterRun(java.util.List messages)
protected final void fireAfterStart()
protected final void fireAfterStop()
protected final java.util.List fireBeforeRun(java.util.List messages)
protected final java.lang.Object fireControlMessageArrived(DataflowReadChannel channel, int index, java.lang.Object message)
public final java.lang.Object fireCustomEvent(java.lang.Object data)
protected final java.lang.Object fireMessageArrived(DataflowReadChannel channel, int index, java.lang.Object message)
protected final java.lang.Object fireMessageSentOut(DataflowWriteChannel channel, int index, java.lang.Object message)
protected final boolean fireOnException(java.lang.Throwable e)
public final DataflowWriteChannel getOutput()
public final DataflowWriteChannel getOutputs(int idx)
public final java.util.List getOutputs()
public final java.lang.Object getStateObject()
public final void join()
public final void registerChannelListenersToAllInputs(DataflowChannelListener handler)
public final void removeDataflowEventListener(DataflowEventListener listener)
@java.lang.SuppressWarningspublic final void removeDataflowEventListener(final DataflowEventListener listener) { final void reportError(java.lang.Throwable e)
static boolean shouldBeMultiThreaded(java.util.Map channels)
public final DataflowProcessor start(PGroup group)
public final DataflowProcessor start()
public final void terminate()
public final void terminateAfterNextRun()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.