|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.serial.WithSerialId groovyx.gpars.actor.impl.MessageStream groovyx.gpars.actor.Actor groovyx.gpars.actor.AbstractLoopingActor
public abstract class AbstractLoopingActor extends Actor
Wraps all actors that repeatedly loop through incoming messages and hold no implicit state between subsequent messages.
Field Summary | |
---|---|
private AsyncMessagingCore |
core
Holds the particular instance of async messaging core to use |
private MessageStream |
currentSender
|
private ActorTimerTask |
currentTimerTask
|
private static long |
serialVersionUID
|
private boolean |
stoppedFlag
|
private boolean |
terminatedFlag
|
boolean |
terminatingFlag
|
private int |
timeoutCounter
|
Fields inherited from class MessageStream | |
---|---|
serialVersionUID |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
AbstractLoopingActor()
|
Method Summary | |
---|---|
private void
|
cancelCurrentTimeoutTask()
|
private Actor
|
doStart()
|
AsyncMessagingCore
|
getCore()
|
protected MessageStream
|
getSender()
Retrieves the sender actor of the currently processed message. |
protected boolean
|
hasBeenStopped()
|
protected void
|
initialize(groovy.lang.Closure code)
Builds the async messaging core using the supplied code handler |
boolean
|
isActive()
|
boolean
|
isFair()
Retrieves the actor's fairness flag Fair actors give up the thread after processing each message, non-fair actors keep a thread until their message queue is empty. |
void
|
makeFair()
Makes the actor fair. |
protected void
|
reply(java.lang.Object message)
Sends a reply to all currently processed messages. |
protected void
|
replyIfExists(java.lang.Object message)
Sends a reply to all currently processed messages, which have been sent by an actor. |
private void
|
runEnhancedWithoutRepliesOnMessages(ActorMessage message, groovy.lang.Closure code, java.lang.Object arguments)
|
MessageStream
|
send(java.lang.Object message)
|
void
|
setParallelGroup(PGroup group)
|
protected void
|
setTimeout(long timeout)
|
Actor
|
silentStart()
Starts the Actor without sending the START_MESSAGE message to speed the start-up. |
Actor
|
start()
Starts the Actor and sends it the START_MESSAGE to run any afterStart handlers. |
Actor
|
stop()
|
protected ActorMessage
|
sweepNextMessage()
Removes the head of the message queue |
Actor
|
terminate()
|
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 |
---|
private AsyncMessagingCore core
private MessageStream currentSender
private ActorTimerTask currentTimerTask
private static final long serialVersionUID
private boolean stoppedFlag
private boolean terminatedFlag
boolean terminatingFlag
private int timeoutCounter
Constructor Detail |
---|
AbstractLoopingActor()
Method Detail |
---|
private void cancelCurrentTimeoutTask()
private Actor doStart()
final AsyncMessagingCore getCore()
protected final MessageStream getSender()
@Override protected final boolean hasBeenStopped()
protected final void initialize(groovy.lang.Closure code)
code
- Code to run on each message
@Override public final boolean isActive()
public final boolean isFair()
public final void makeFair()
protected final void reply(java.lang.Object message)
message
- reply message
protected final void replyIfExists(java.lang.Object message)
message
- reply message
private void runEnhancedWithoutRepliesOnMessages(ActorMessage message, groovy.lang.Closure code, java.lang.Object arguments)
@Override public MessageStream send(java.lang.Object message)
@Override public void setParallelGroup(PGroup group)
protected final void setTimeout(long timeout)
@Override public Actor silentStart()
@Override public Actor start()
@Override public final Actor stop()
@Override protected ActorMessage sweepNextMessage()
@Override public final Actor terminate()
Copyright © 2008–2012 Václav Pech. All Rights Reserved.