org.curjent.impl.agent
Class MessageFuture

java.lang.Object
  extended by org.curjent.impl.agent.MessageFuture
All Implemented Interfaces:
Future<Object>
Direct Known Subclasses:
MessageCall

public class MessageFuture
extends Object
implements Future<Object>

Delegates all Future calls to a Message receiver. Used to isolate a message from client synchronization and casting.


Field Summary
protected  Message message
          Call receiver.
 
Constructor Summary
MessageFuture(Message message)
          Saves the receiver.
 
Method Summary
 boolean cancel(boolean interruptably)
          Delegates to Message.cancel(boolean).
 Object get()
          Delegates to Message.get(long, TimeUnit).
 Object get(long timeout, TimeUnit unit)
          Delegates to Message.get(long, TimeUnit).
 boolean isCancelled()
          Returns true if Message.getCompletion() returns CallCompletion.FUTURE_CANCELLED.
 boolean isDone()
          Delegates to Message.isFinished().
 String toString()
          Returns the message's interface method signature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected final Message message
Call receiver.

Constructor Detail

MessageFuture

public MessageFuture(Message message)
Saves the receiver.

Method Detail

cancel

public final boolean cancel(boolean interruptably)
Delegates to Message.cancel(boolean).

Specified by:
cancel in interface Future<Object>

get

public final Object get()
                 throws InterruptedException,
                        ExecutionException
Delegates to Message.get(long, TimeUnit).

Specified by:
get in interface Future<Object>
Throws:
InterruptedException
ExecutionException

get

public final Object get(long timeout,
                        TimeUnit unit)
                 throws InterruptedException,
                        ExecutionException,
                        TimeoutException
Delegates to Message.get(long, TimeUnit).

Specified by:
get in interface Future<Object>
Throws:
InterruptedException
ExecutionException
TimeoutException

isCancelled

public final boolean isCancelled()
Returns true if Message.getCompletion() returns CallCompletion.FUTURE_CANCELLED.

Specified by:
isCancelled in interface Future<Object>

isDone

public final boolean isDone()
Delegates to Message.isFinished().

Specified by:
isDone in interface Future<Object>

toString

public final String toString()
Returns the message's interface method signature.

Overrides:
toString in class Object


Copyright 2009-2011 Tom Landon
Apache License 2.0