T - the future result type of an asynchronous operation.public class BasicFuture<T> extends java.lang.Object implements java.util.concurrent.Future<T>, Cancellable
Future interface. BasicFuture
can be put into a completed state by invoking any of the following methods:
cancel(), failed(Exception), or completed(Object).| Constructor and Description |
|---|
BasicFuture(FutureCallback<T> callback) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel() |
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
completed(T result) |
boolean |
failed(java.lang.Exception exception) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
public BasicFuture(FutureCallback<T> callback)
public boolean isCancelled()
isCancelled in interface java.util.concurrent.Future<T>public boolean isDone()
isDone in interface java.util.concurrent.Future<T>public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get in interface java.util.concurrent.Future<T>java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic boolean completed(T result)
public boolean failed(java.lang.Exception exception)
public boolean cancel(boolean mayInterruptIfRunning)
cancel in interface java.util.concurrent.Future<T>public boolean cancel()
cancel in interface Cancellable