com.threerings.presents.util
Class FutureResult<V>

java.lang.Object
  extended by com.threerings.presents.util.FutureResult<V>
All Implemented Interfaces:
InvocationService.InvocationListener, InvocationService.ResultListener, Future<V>

public class FutureResult<V>
extends Object
implements Future<V>, InvocationService.ResultListener

Provides the result of an invocation service request as a future result. Modeled on and mostly implemented by code from FutureTask.


Nested Class Summary
protected  class FutureResult.Sync
           
 
Field Summary
protected  FutureResult.Sync _sync
           
 
Constructor Summary
FutureResult()
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 V get()
           
 V get(long timeout, TimeUnit unit)
           
 boolean isCancelled()
           
 boolean isDone()
           
 void requestFailed(String cause)
          Called to report request failure.
 void requestProcessed(Object result)
          Indicates that the request was successfully processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_sync

protected FutureResult.Sync _sync
Constructor Detail

FutureResult

public FutureResult()
Method Detail

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface Future<V>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface Future<V>

isDone

public boolean isDone()
Specified by:
isDone in interface Future<V>

get

public V get()
      throws InterruptedException,
             ExecutionException
Specified by:
get in interface Future<V>
Throws:
InterruptedException
ExecutionException

get

public V get(long timeout,
             TimeUnit unit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException
Specified by:
get in interface Future<V>
Throws:
InterruptedException
ExecutionException
TimeoutException

requestProcessed

public void requestProcessed(Object result)
Description copied from interface: InvocationService.ResultListener
Indicates that the request was successfully processed.

Specified by:
requestProcessed in interface InvocationService.ResultListener

requestFailed

public void requestFailed(String cause)
Description copied from interface: InvocationService.InvocationListener
Called to report request failure. If the invocation services system detects failure of any kind, it will report it via this callback. Particular services may also make use of this callback to report failures of their own, or they may opt to define more specific failure callbacks.

Specified by:
requestFailed in interface InvocationService.InvocationListener