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)
.Constructor and Description |
---|
BasicFuture(FutureCallback<T> callback) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Cancels the ongoing operation or process.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
boolean |
completed(T result) |
boolean |
failed(Exception exception) |
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
public BasicFuture(FutureCallback<T> callback)
public boolean isCancelled()
isCancelled
in interface Future<T>
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 completed(T result)
public boolean failed(Exception exception)
public boolean cancel(boolean mayInterruptIfRunning)
public boolean cancel()
Cancellable
cancel
in interface Cancellable
true
if the operation or process has been cancelled as a result of
this method call or false
if it has already been cancelled or not started.Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.