|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.actor.Actor
gpars.actor.impl.SequentialProcessingActor
@SuppressWarnings({"UnqualifiedStaticUsage"}) class SequentialProcessingActor extends Actor
Nested Class Summary | |
---|---|
class |
SequentialProcessingActor.MultiMessageReaction
Enables multiple argument closures to be passed to react(). |
class |
SequentialProcessingActor.Node
Represents an element in the message queue. |
class |
SequentialProcessingActor.Reaction
Buffers messages for the next continuation of an event-driven actor, handles timeouts and no-param continuations. |
Field Summary | |
---|---|
protected static int |
S_ACTIVE_MASK
|
protected static int |
S_FINISHED_MASK
|
protected static int |
S_FINISHING_MASK
|
protected static int |
S_NOT_STARTED
|
protected static int |
S_RUNNING
|
protected static int |
S_STOPPED
|
protected static int |
S_STOPPING
|
protected static int |
S_STOP_TERMINATE_MASK
|
protected static int |
S_TERMINATED
|
protected static int |
S_TERMINATING
|
protected PGroup |
actorGroup
The actor group to which the actor belongs |
protected Runnable |
loopCode
Code for the loop, if any |
protected int |
stopFlag
Indicates whether the actor should terminate |
protected static AtomicIntegerFieldUpdater |
stopFlagUpdater
|
Constructor Summary | |
protected SequentialProcessingActor()
Creates a new instance, sets the default actor group. |
Method Summary | |
---|---|
protected void
|
checkStopTerminate()
|
protected void
|
doOnException(Throwable exception)
Allows subclasses to add behavior to run after exception in actor's body |
protected void
|
doOnInterrupt(InterruptedException exception)
Allows subclasses to add behavior to run after actor's interruption |
protected void
|
doOnStart()
Allows subclasses to add behavior to run after actor's start |
protected void
|
doOnTermination()
Allows subclasses to add behavior to run after actor's termination |
protected void
|
doOnTimeout()
Allows subclasses to add behavior to run after actor's timeout |
PGroup
|
getActorGroup()
Retrieves the group to which the actor belongs |
boolean
|
isActive()
Checks the current status of the Actor. |
boolean
|
isActorThread()
Checks whether the current thread is the actor's current thread. |
protected void
|
loop(Runnable code)
Ensures that the supplied closure will be invoked repeatedly in a loop. |
protected ActorMessage
|
pollMessage()
Polls a message from the queues |
protected void
|
react(Duration duration, Closure code)
Schedules an ActorAction to take the next message off the message queue and to pass it on to the supplied closure. |
protected void
|
react(Closure code)
Schedules an ActorAction to take the next message off the message queue and to pass it on to the supplied closure. |
protected void
|
react(long timeout, TimeUnit timeUnit, Closure code)
Schedules an ActorAction to take the next message off the message queue and to pass it on to the supplied closure. |
protected void
|
react(long timeout, Closure code)
Schedules an ActorAction to take the next message off the message queue and to pass it on to the supplied closure. |
void
|
run()
|
void
|
runReaction(ActorMessage message, Closure code)
|
protected void
|
scheduleLoop()
|
MessageStream
|
send(Object message)
|
void
|
setActorGroup(PGroup group)
Sets the actor's group. |
SequentialProcessingActor
|
start()
Starts the Actor. |
Actor
|
stop()
Send message to stop to the actor. |
protected ActorMessage
|
takeMessage()
Takes a message from the queues. |
protected ActorMessage
|
takeMessage(long timeout, TimeUnit timeUnit)
Takes a message from the queues. |
Actor
|
terminate()
Terminate the Actor. |
Field Detail |
---|
protected static final int S_ACTIVE_MASK
protected static final int S_FINISHED_MASK
protected static final int S_FINISHING_MASK
protected static final int S_NOT_STARTED
protected static final int S_RUNNING
protected static final int S_STOPPED
protected static final int S_STOPPING
protected static final int S_STOP_TERMINATE_MASK
protected static final int S_TERMINATED
protected static final int S_TERMINATING
protected PGroup actorGroup
protected Runnable loopCode
protected int stopFlag
protected static final AtomicIntegerFieldUpdater stopFlagUpdater
Constructor Detail |
---|
protected SequentialProcessingActor()
Method Detail |
---|
protected final void checkStopTerminate()
protected void doOnException(Throwable exception)
protected void doOnInterrupt(InterruptedException exception)
protected void doOnStart()
protected void doOnTermination()
protected void doOnTimeout()
public PGroup getActorGroup()
@Override public final boolean isActive()
@Override public final boolean isActorThread()
protected final void loop(Runnable code)
protected final ActorMessage pollMessage()
protected final void react(Duration duration, Closure code)
protected final void react(Closure code)
protected final void react(long timeout, TimeUnit timeUnit, Closure code)
protected final void react(long timeout, Closure code)
@SuppressWarnings({"ThrowCaughtLocally"}) public void run()
public void runReaction(ActorMessage message, Closure code)
protected void scheduleLoop()
@Override public final MessageStream send(Object message)
public final void setActorGroup(PGroup group)
@Override public final SequentialProcessingActor start()
@Override public final Actor stop()
protected final ActorMessage takeMessage()
protected ActorMessage takeMessage(long timeout, TimeUnit timeUnit)
@Override public final Actor terminate()
Groovy Documentation