public abstract class AbstractLoopingActor extends Actor
MessageStream.RemoteMessageStream, MessageStream.SendTo| Modifier and Type | Field and Description |
|---|---|
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 |
(package private) boolean |
terminatingFlag |
private int |
timeoutCounter |
ACTOR_HAS_ALREADY_BEEN_STARTED, CANNOT_SEND_REPLIES_NO_SENDER_HAS_BEEN_REGISTERED, currentThread, parallelGroup, START_MESSAGE, STOP_MESSAGE, TERMINATE_MESSAGE, TIMEOUT, TIMEOUT_MESSAGE, timerserialHandle| Constructor and Description |
|---|
AbstractLoopingActor() |
| Modifier and Type | Method and Description |
|---|---|
private void |
cancelCurrentTimeoutTask() |
private Actor |
doStart() |
(package private) AsyncMessagingCore |
getCore() |
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()
Checks the current status of the Actor.
|
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.
|
void |
reply(java.lang.Object message)
Sends a reply to all currently processed messages.
|
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)
Send message to stream and return immediately
|
void |
setParallelGroup(PGroup group)
Sets the parallel 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()
Send message to stop to the Actor.
|
protected ActorMessage |
sweepNextMessage()
Removes the head of the message queue
|
Actor |
terminate()
Terminates the Actor.
|
createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleStart, handleTermination, handleTimeout, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, sendAndPromise, sweepQueue, threadBoundActorcall, getRemoteClass, leftShift, send, send, sendAndWait, sendAndWait, sendAndWaitgetOrCreateSerialHandle, writeReplaceprivate static final long serialVersionUID
private volatile boolean stoppedFlag
private volatile boolean terminatedFlag
volatile boolean terminatingFlag
private ActorTimerTask currentTimerTask
private int timeoutCounter
private MessageStream currentSender
private AsyncMessagingCore core
final AsyncMessagingCore getCore()
protected final void initialize(groovy.lang.Closure code)
code - Code to run on each messagepublic final boolean isFair()
public final void makeFair()
protected final void setTimeout(long timeout)
private void cancelCurrentTimeoutTask()
public Actor silentStart()
silentStart in class Actorpublic Actor start()
private Actor doStart()
public final Actor stop()
Actorpublic final Actor terminate()
Actorpublic final boolean isActive()
Actorprotected final boolean hasBeenStopped()
hasBeenStopped in class Actorprotected ActorMessage sweepNextMessage()
sweepNextMessage in class Actorpublic MessageStream send(java.lang.Object message)
MessageStreamsend in class MessageStreammessage - message to sendpublic void setParallelGroup(PGroup group)
ActorsetParallelGroup in class Actorgroup - new grouppublic final MessageStream getSender()
ActorReplyException - If some of the replies failed to be sent.public final void reply(java.lang.Object message)
message - reply messageActorReplyException - If some of the replies failed to be sent.public final void replyIfExists(java.lang.Object message)
message - reply messageprivate void runEnhancedWithoutRepliesOnMessages(ActorMessage message, groovy.lang.Closure code, java.lang.Object arguments)