edu.emory.mathcs.rmix.spi
Class CompletedRmixFuture

java.lang.Object
  extended byedu.emory.mathcs.rmix.spi.CompletedRmixFuture
All Implemented Interfaces:
Future, Future, Rmix.Future

public class CompletedRmixFuture
extends java.lang.Object
implements Rmix.Future


Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Always returns false.
static Rmix.Future completed(java.lang.Object result)
          Creates a successfully completed future with specified result.
static Rmix.Future completed(java.lang.Object result, Callback cb)
          Creates a successfully completed future with specified result and completion callback.
static Rmix.Future failed(java.lang.Throwable cause)
          Creates a failed future with specified failure cause.
static Rmix.Future failed(java.lang.Throwable cause, Callback cb)
          Creates a failed future with specified failure cause and completion callback.
 java.lang.Object get()
          Waits if necessary for the computation to complete, and then retrieves its result.
 java.lang.Object get(long timeout, TimeUnit granularity)
          Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
 boolean isCancelled()
          Always returns false.
 boolean isDone()
          Always returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public java.lang.Object get()
                     throws ExecutionException
Description copied from interface: Future
Waits if necessary for the computation to complete, and then retrieves its result.

Specified by:
get in interface Future
Returns:
the computed result
Throws:
ExecutionException - if the computation threw an exception

get

public java.lang.Object get(long timeout,
                            TimeUnit granularity)
                     throws ExecutionException
Description copied from interface: Future
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Specified by:
get in interface Future
Parameters:
timeout - the maximum time to wait
granularity - the time unit of the timeout argument
Returns:
the computed result
Throws:
ExecutionException - if the computation threw an exception

isDone

public boolean isDone()
Always returns true.

Specified by:
isDone in interface Future
Returns:
true

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Always returns false.

Specified by:
cancel in interface Future
Parameters:
mayInterruptIfRunning - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete
Returns:
false

isCancelled

public boolean isCancelled()
Always returns false.

Specified by:
isCancelled in interface Future
Returns:
false

completed

public static Rmix.Future completed(java.lang.Object result)
Creates a successfully completed future with specified result.

Parameters:
result - the result of the future
Returns:
the completed future

completed

public static Rmix.Future completed(java.lang.Object result,
                                    Callback cb)
Creates a successfully completed future with specified result and completion callback. If not null, the callback is immediately notified about the completion.

Parameters:
result - the result of the future
cb - the callback to be notified about successful completion
Returns:
the completed future

failed

public static Rmix.Future failed(java.lang.Throwable cause)
Creates a failed future with specified failure cause.

Parameters:
cause - the cause of failure
Returns:
the completed future

failed

public static Rmix.Future failed(java.lang.Throwable cause,
                                 Callback cb)
Creates a failed future with specified failure cause and completion callback. If not null, the callback is immediately notified about the completion.

Parameters:
cause - the cause of failure
cb - the callback to be notified about failure
Returns:
the completed future