groovyx.gpars.actor.impl
Class ReplyingMessageStream

java.lang.Object
  extended by groovyx.gpars.serial.WithSerialId
      extended by groovyx.gpars.actor.impl.MessageStream
          extended by groovyx.gpars.actor.Actor
              extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class groovyx.gpars.actor.Actor
Actor.MyRemoteHandle, Actor.RemoteActor
 
Nested classes/interfaces inherited from class groovyx.gpars.actor.impl.MessageStream
MessageStream.RemoteMessageStream, MessageStream.SendTo
 
Field Summary
private  MessageStream sender
          A list of senders for the currently processed messages
private static long serialVersionUID
           
 
Fields inherited from class groovyx.gpars.actor.Actor
ACTOR_HAS_ALREADY_BEEN_STARTED, CANNOT_SEND_REPLIES_NO_SENDER_HAS_BEEN_REGISTERED, currentThread, parallelGroup, START_MESSAGE, STOP_MESSAGE, TERMINATE_MESSAGE, TIMEOUT, TIMEOUT_MESSAGE, timer
 
Fields inherited from class groovyx.gpars.serial.WithSerialId
serialHandle
 
Constructor Summary
ReplyingMessageStream()
           
 
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, setParallelGroup, silentStart, start, stop, sweepNextMessage, terminate, threadBoundActor
 
Methods inherited from class groovyx.gpars.actor.impl.MessageStream
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class groovyx.gpars.serial.WithSerialId
getOrCreateSerialHandle, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

sender

private MessageStream sender
A list of senders for the currently processed messages

Constructor Detail

ReplyingMessageStream

public ReplyingMessageStream()
Method Detail

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

Copyright © 2008–2010 Václav Pech. All Rights Reserved.