groovyx.gpars.actor.impl
Class ReplyingMessageStream
java.lang.Object
groovyx.gpars.serial.WithSerialId
groovyx.gpars.actor.impl.MessageStream
groovyx.gpars.actor.Actor
groovyx.gpars.actor.impl.ReplyingMessageStream
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- SequentialProcessingActor
public abstract class ReplyingMessageStream
- extends Actor
- Author:
- Alex Tkachman, Vaclav Pech
- See Also:
- Serialized Form
Method Summary |
protected MessageStream |
getSender()
|
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. |
protected void |
setSender(MessageStream sender)
|
Methods inherited from class groovyx.gpars.actor.Actor |
createActorMessage, createRemoteHandle, deregisterCurrentActorWithThread, getJoinLatch, getParallelGroup, handleException, handleInterrupt, handleStart, handleTermination, handleTimeout, hasBeenStopped, isActive, isActorThread, join, join, join, join, onStop, registerCurrentActorWithThread, sendAndContinue, sendAndPromise, setParallelGroup, silentStart, start, stop, sweepNextMessage, terminate, threadBoundActor |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
sender
private MessageStream sender
- A list of senders for the currently processed messages
ReplyingMessageStream
public ReplyingMessageStream()
getSender
protected final MessageStream getSender()
setSender
protected final void setSender(MessageStream sender)
reply
protected final void reply(java.lang.Object message)
- 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().
- Parameters:
message
- reply message
- Throws:
ActorReplyException
- If some of the replies failed to be sent.
replyIfExists
protected final void replyIfExists(java.lang.Object message)
- Sends 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.
- Parameters:
message
- reply message