public abstract class BlockingActor extends SequentialProcessingActor
MessageStream.RemoteMessageStream, MessageStream.SendTo| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AN_ACTOR_CAN_ONLY_RECEIVE_ONE_MESSAGE_AT_A_TIME |
private static long |
serialVersionUID |
private static java.lang.String |
THE_ACTOR_HAS_BEEN_STOPPED |
private static java.lang.String |
THE_ACTOR_HAS_NOT_BEEN_STARTED |
S_ACTIVE_MASK, S_FINISHED_MASK, S_FINISHING_MASK, S_NOT_STARTED, S_RUNNING, S_STOP_TERMINATE_MASK, S_STOPPED, S_STOPPING, S_TERMINATED, S_TERMINATING, stopFlag, stopFlagUpdaterACTOR_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 |
|---|
BlockingActor() |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkStoppedFlags() |
private java.lang.Object |
enhanceAndUnwrap(ActorMessage message) |
private void |
enhanceReplies(ActorMessage message)
Adds
reply and replyIfExists methods to the current Actor and the message. |
protected void |
handleStart() |
protected void |
receive(groovy.lang.Closure handler)
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive.
|
protected void |
receive(groovy.time.Duration duration,
groovy.lang.Closure handler)
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive.
|
protected void |
receive(long timeout,
java.util.concurrent.TimeUnit timeUnit,
groovy.lang.Closure handler)
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive.
|
protected java.lang.Object |
receiveImpl()
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive.
|
protected java.lang.Object |
receiveImpl(long timeout,
java.util.concurrent.TimeUnit units)
Retrieves a message from the message queue, waiting, if necessary, for a message to arrive.
|
act, checkStopTerminate, handleTermination, hasBeenStopped, isActive, pollMessage, receive, receive, receive, run, send, setParallelGroup, silentStart, start, stop, sweepNextMessage, takeMessage, takeMessage, terminategetSender, reply, replyIfExists, setSendercreateActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleTimeout, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, sendAndPromise, sweepQueue, threadBoundActorcall, getRemoteClass, leftShift, send, send, sendAndWait, sendAndWait, sendAndWaitgetOrCreateSerialHandle, writeReplaceprivate static final java.lang.String THE_ACTOR_HAS_NOT_BEEN_STARTED
private static final java.lang.String THE_ACTOR_HAS_BEEN_STOPPED
private static final long serialVersionUID
public static final java.lang.String AN_ACTOR_CAN_ONLY_RECEIVE_ONE_MESSAGE_AT_A_TIME
private void enhanceReplies(ActorMessage message)
reply and replyIfExists methods to the current Actor and the message.
These methods will call send on the target actor (the sender of the original message). The
reply/replyIfExists methods invoked on the actor will be sent to all currently
processed messages, reply/replyIfExists invoked on a message will send a reply to the
sender of that particular message only.message - The original messageprotected final java.lang.Object receiveImpl()
throws java.lang.InterruptedException
receiveImpl in class SequentialProcessingActorjava.lang.InterruptedException - If the thread is interrupted during the wait. Should propagate up to stop the thread.protected final java.lang.Object receiveImpl(long timeout,
java.util.concurrent.TimeUnit units)
throws java.lang.InterruptedException
receiveImpl in class SequentialProcessingActortimeout - how long to wait before giving up, in units of unitunits - a TimeUnit determining how to interpret the timeout parameterjava.lang.InterruptedException - If the thread is interrupted during the wait. Should propagate up to stop the thread.private java.lang.Object enhanceAndUnwrap(ActorMessage message)
private void checkStoppedFlags()
protected final void receive(groovy.lang.Closure handler)
throws java.lang.InterruptedException
handler - A closure accepting the retrieved message as a parameter, which will be invoked after a message is received.java.lang.InterruptedException - If the thread is interrupted during the wait. Should propagate up to stop the thread.protected final void receive(long timeout,
java.util.concurrent.TimeUnit timeUnit,
groovy.lang.Closure handler)
throws java.lang.InterruptedException
timeout - how long to wait before giving up, in units of unittimeUnit - a TimeUnit determining how to interpret the timeout parameterhandler - A closure accepting the retrieved message as a parameter, which will be invoked after a message is received.java.lang.InterruptedException - If the thread is interrupted during the wait. Should propagate up to stop the thread.protected final void receive(groovy.time.Duration duration,
groovy.lang.Closure handler)
throws java.lang.InterruptedException
duration - how long to wait before giving up, in units of unithandler - A closure accepting the retrieved message as a parameter, which will be invoked after a message is received.java.lang.InterruptedException - If the thread is interrupted during the wait. Should propagate up to stop the thread.protected void handleStart()
handleStart in class Actor