org.codehaus.gpars

groovyx.gpars.actor.impl
[Java] Class MessageStream.ResultWaiter

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      groovyx.gpars.actor.impl.MessageStream
          groovyx.gpars.actor.impl.MessageStream.ResultWaiter

private static class MessageStream.ResultWaiter
extends MessageStream

Represents a pending request for a reply from an actor.

Parameters:
- The type of expected reply message


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.

 
Fields inherited from class MessageStream
serialVersionUID
 
Fields inherited from class WithSerialId
serialHandle, serialVersionUID
 
Constructor Summary
private MessageStream.ResultWaiter()

 
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 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

isSet

private boolean isSet


serialVersionUID

private static final long serialVersionUID


value

private java.lang.Object value
Holds a reference to the calling thread, while waiting, and the received reply message, once it has arrived.


 
Constructor Detail

MessageStream.ResultWaiter

private MessageStream.ResultWaiter()


 
Method Detail

getResult

@SuppressWarnings("unchecked")
public V getResult()
Retrieves the response blocking until a message arrives
throws:
InterruptedException If the thread gets interrupted
Returns:
The received message


getResult

public java.lang.Object getResult(long timeout, java.util.concurrent.TimeUnit units)
Retrieves the response blocking until a message arrives
throws:
InterruptedException If the thread gets interrupted
Parameters:
timeout - How long to wait
units - Unit for the timeout
Returns:
The received message


onDeliveryError

@SuppressWarnings("unused") //  TODO:  Eclipse requires this to be tagged as unused.
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


rethrowException

private void rethrowException()


send

@Override
public MessageStream send(java.lang.Object message)
Accepts the message as a reply and wakes up the sleeping thread.
Parameters:
message - message to send
Returns:
this


 

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