Wraps all actors that repeatedly loop through incoming messages and hold no implicit state between subsequent messages.
Modifiers | Name | 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 |
|
boolean |
terminatingFlag |
|
private int |
timeoutCounter |
Fields inherited from class | Fields |
---|---|
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 |
class MessageStream |
serialVersionUID |
class WithSerialId |
serialHandle, serialVersionUID |
Constructor and description |
---|
AbstractLoopingActor
() |
Type | Name and description |
---|---|
private void |
cancelCurrentTimeoutTask() |
private Actor |
doStart() |
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() |
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) |
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() |
Holds the particular instance of async messaging core to use
Retrieves the sender actor of the currently processed message.
Builds the async messaging core using the supplied code handler
code
- Code to run on each messageRetrieves 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. Non-fair actors tend to perform better than fair ones.
Makes the actor fair. Actors are non-fair by default. Fair actors give up the thread after processing each message, non-fair actors keep a thread until their message queue is empty. Non-fair actors tend to perform better than fair ones.
Sends a reply to all currently processed messages. Throws ActorReplyException if some messages have not been sent by an actor. For such cases use replyIfExists().
message
- reply messageSends a reply to all currently processed messages, which have been sent by an actor. Ignores potential errors when sending the replies, like no sender or sender already stopped.
message
- reply messageStarts the Actor without sending the START_MESSAGE message to speed the start-up. The potential custom afterStart handlers won't be run. No messages can be sent or received before an Actor is started.
Starts the Actor and sends it the START_MESSAGE to run any afterStart handlers. No messages can be sent or received before an Actor is started.
Removes the head of the message queue
Copyright © 2008–2014 Václav Pech. All Rights Reserved.