groovyx.gpars.actor.impl
Class MessageStream.ResultWaiter<V>
java.lang.Object
  
groovyx.gpars.serial.WithSerialId
      
groovyx.gpars.actor.impl.MessageStream
          
groovyx.gpars.actor.impl.MessageStream.ResultWaiter<V>
- Type Parameters:
 V - The type of expected reply message
- All Implemented Interfaces: 
 - java.io.Serializable
 
- Enclosing class:
 - MessageStream
 
private static class MessageStream.ResultWaiter<V>
- extends MessageStream
 
Represents a pending request for a reply from an actor.
 
 
| 
Field Summary | 
private  boolean | 
isSet
 
            | 
private static long | 
serialVersionUID
 
            | 
private  java.lang.Object | 
value
 
          Holds a reference to the calling thread, while waiting, and the received reply message, once it has arrived. | 
 
 
 
| 
Method Summary | 
 V | 
getResult()
 
          Retrieves the response blocking until a message arrives | 
 java.lang.Object | 
getResult(long timeout,
          java.util.concurrent.TimeUnit units)
 
          Retrieves the response blocking until a message arrives | 
 void | 
onDeliveryError(java.lang.Object msg)
 
          Handle cases when the message sent to the actor doesn't get delivered | 
private  void | 
rethrowException()
 
            | 
 MessageStream | 
send(java.lang.Object message)
 
          Accepts the message as a reply and wakes up the sleeping thread. | 
 
 
 
| 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
 
value
private volatile java.lang.Object value
- Holds a reference to the calling thread, while waiting, and the received reply message, once it has arrived.
 
isSet
private volatile boolean isSet
MessageStream.ResultWaiter
private MessageStream.ResultWaiter()
send
public MessageStream send(java.lang.Object message)
- Accepts the message as a reply and wakes up the sleeping thread.
- Specified by:
 send in class MessageStream
 
- Parameters:
 message - message to send
- Returns:
 - this
 
 
 
getResult
public V getResult()
            throws java.lang.InterruptedException
- Retrieves the response blocking until a message arrives
- Returns:
 - The received message
 - Throws:
 java.lang.InterruptedException - If the thread gets interrupted
 
 
getResult
public java.lang.Object getResult(long timeout,
                                  java.util.concurrent.TimeUnit units)
                           throws java.lang.InterruptedException
- Retrieves the response blocking until a message arrives
- Parameters:
 timeout - How long to waitunits - Unit for the timeout
- Returns:
 - The received message
 - Throws:
 java.lang.InterruptedException - If the thread gets interrupted
 
 
rethrowException
private void rethrowException()
 
onDeliveryError
public void onDeliveryError(java.lang.Object msg)
- Handle cases when the message sent to the actor doesn't get delivered
- Parameters:
 msg - The message that failed to get delivered