T
- the future result type of an asynchronous operation.public class BasicFuture<T> extends Object implements 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)
.Modifier and Type | Field and Description |
---|---|
private FutureCallback<T> |
callback |
private boolean |
cancelled |
private boolean |
completed |
private Exception |
ex |
private T |
result |
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(Exception exception) |
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
private T |
getResult() |
boolean |
isCancelled() |
boolean |
isDone() |
private final FutureCallback<T> callback
private volatile boolean completed
private volatile boolean cancelled
public BasicFuture(FutureCallback<T> callback)
public boolean isCancelled()
isCancelled
in interface Future<T>
private T getResult() throws ExecutionException
ExecutionException
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public boolean cancel(boolean mayInterruptIfRunning)
public boolean cancel()
cancel
in interface Cancellable
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses