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
java.lang.Object 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
 

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 java.lang.Object 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–2012 Václav Pech. All Rights Reserved.