org.codehaus.gpars

groovyx.gpars.dataflow.operator
[Java] Class DataflowProcessorActor

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      groovyx.gpars.actor.impl.MessageStream
          groovyx.gpars.actor.Actor
              groovyx.gpars.actor.AbstractLoopingActor
                  groovyx.gpars.actor.StaticDispatchActor
                      groovyx.gpars.dataflow.operator.DataflowProcessorActor

@SuppressWarnings({"RawUseOfParameterizedType"})
abstract class DataflowProcessorActor
extends StaticDispatchActor

A base actor class for operators' and selectors' actors

Authors:
Vaclav Pech


Field Summary
protected static java.lang.String CANNOT_OBTAIN_THE_SEMAPHORE_TO_FORK_OPERATOR_S_BODY

protected groovy.lang.Closure code

protected java.util.List inputs

protected java.util.List outputs

protected DataflowProcessor owningProcessor

protected boolean stoppingGently

 
Fields inherited from class StaticDispatchActor
serialVersionUID
 
Fields inherited from class AbstractLoopingActor
core, currentSender, currentTimerTask, serialVersionUID, stoppedFlag, terminatedFlag, terminatingFlag, timeoutCounter
 
Fields inherited from class Actor
ACTOR_HAS_ALREADY_BEEN_STARTED, AFTER_START, CANNOT_SEND_REPLIES_NO_SENDER_HAS_BEEN_REGISTERED, EMPTY_ARGUMENTS, ON_DELIVERY_ERROR, RESPONDS_TO, START_MESSAGE, STOP_MESSAGE, TERMINATE_MESSAGE, TIMEOUT, TIMEOUT_MESSAGE, currentActorPerThread, currentThread, joinLatch, onStop, parallelGroup, serialVersionUID, timer
 
Fields inherited from class MessageStream
serialVersionUID
 
Fields inherited from class WithSerialId
serialHandle, serialVersionUID
 
Constructor Summary
DataflowProcessorActor(DataflowProcessor owningProcessor, PGroup group, java.util.List outputs, java.util.List inputs, groovy.lang.Closure code)

 
Method Summary
void afterStart()

void afterStop()

void checkPoison(java.lang.Object data)

Handles the poisson message.

protected java.lang.Object fireMessageArrived(java.lang.Object result, int index, boolean controlMessage)

protected void forwardPoisonPill(java.lang.Object data)

static boolean isControlMessage(java.lang.Object message)

void onException(java.lang.Throwable e)

void onMessage(java.lang.Object message)

All messages unhandled by sub-classes will result in an exception being thrown

void registerChannelListenersToAllInputs(DataflowChannelListener handler)

Registers the provided handler to all input channels

void reportException(java.lang.Throwable e)

MessageStream send(java.lang.Object message)

Sends the message, ignoring exceptions caused by the actor not being active anymore

 
Methods inherited from class StaticDispatchActor
onMessage
 
Methods inherited from class AbstractLoopingActor
cancelCurrentTimeoutTask, doStart, getCore, getSender, hasBeenStopped, initialize, isActive, isFair, makeFair, reply, replyIfExists, runEnhancedWithoutRepliesOnMessages, send, setParallelGroup, setTimeout, silentStart, start, stop, sweepNextMessage, terminate
 
Methods inherited from class Actor
callDynamic, createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleStart, handleTermination, handleTimeout, hasBeenStopped, isActive, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, sendAndPromise, setParallelGroup, silentStart, start, stop, sweepNextMessage, sweepQueue, terminate, threadBoundActor
 
Methods inherited from class MessageStream
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class WithSerialId
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace
 

Field Detail

CANNOT_OBTAIN_THE_SEMAPHORE_TO_FORK_OPERATOR_S_BODY

protected static final java.lang.String CANNOT_OBTAIN_THE_SEMAPHORE_TO_FORK_OPERATOR_S_BODY


code

protected final groovy.lang.Closure code


inputs

protected final java.util.List inputs


outputs

protected final java.util.List outputs


owningProcessor

protected final DataflowProcessor owningProcessor


stoppingGently

protected boolean stoppingGently


 
Constructor Detail

DataflowProcessorActor

@SuppressWarnings({"AssignmentToCollectionOrArrayFieldFromParameter"})
DataflowProcessorActor(DataflowProcessor owningProcessor, PGroup group, java.util.List outputs, java.util.List inputs, groovy.lang.Closure code)


 
Method Detail

afterStart

void afterStart()


afterStop

void afterStop()


checkPoison

final void checkPoison(java.lang.Object data)
Handles the poisson message. After receiving the poisson a dataflow operator will send the poisson to all its output channels and terminate.
Parameters:
data - The poisson to re-send
Returns:
True, if poisson has been received


fireMessageArrived

protected java.lang.Object fireMessageArrived(java.lang.Object result, int index, boolean controlMessage)


forwardPoisonPill

protected void forwardPoisonPill(java.lang.Object data)


isControlMessage

static boolean isControlMessage(java.lang.Object message)


onException

final void onException(java.lang.Throwable e)


onMessage

@Override
public void onMessage(java.lang.Object message)
All messages unhandled by sub-classes will result in an exception being thrown
Parameters:
message - The unhandled message


registerChannelListenersToAllInputs

final void registerChannelListenersToAllInputs(DataflowChannelListener handler)
Registers the provided handler to all input channels
Parameters:
handler - The closure to invoke whenever a value gets bound to any of the input channels


reportException

final void reportException(java.lang.Throwable e)


send

@Override
public MessageStream send(java.lang.Object message)
Sends the message, ignoring exceptions caused by the actor not being active anymore
Parameters:
message - The message to send
Returns:
The current actor


 

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