org.codehaus.gpars

groovyx.gpars.actor.impl
[Java] Class ReplyingMessageStream

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      groovyx.gpars.actor.impl.MessageStream
          groovyx.gpars.actor.Actor
              groovyx.gpars.actor.impl.ReplyingMessageStream

@SuppressWarnings({"ThrowableInstanceNeverThrown"})
public abstract class ReplyingMessageStream
extends Actor

Authors:
Alex Tkachman, Vaclav Pech


Field Summary
private MessageStream sender

A list of senders for the currently processed messages

private static long serialVersionUID

 
Fields inherited from 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
 
Fields inherited from class MessageStream
serialVersionUID
 
Fields inherited from class WithSerialId
serialHandle, serialVersionUID
 
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 Actor
callDynamic, 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, sweepQueue, terminate, threadBoundActor
 
Methods inherited from class MessageStream
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class WithSerialId
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

sender

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


serialVersionUID

private static final long serialVersionUID


 
Constructor Detail

ReplyingMessageStream

ReplyingMessageStream()


 
Method Detail

getSender

@SuppressWarnings({"ReturnOfCollectionOrArrayField"})
protected final MessageStream getSender()


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().
throws:
groovyx.gpars.actor.impl.ActorReplyException If some of the replies failed to be sent.
Parameters:
message - reply message


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


setSender

protected final void setSender(MessageStream sender)


 

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