Package org.apache.http.concurrent
Class BasicFuture<T>
java.lang.Object
org.apache.http.concurrent.BasicFuture<T>
- Type Parameters:
T
- the future result type of an asynchronous operation.
- All Implemented Interfaces:
Future<T>
,Cancellable
Basic implementation of the
Future
interface. BasicFuture
can be put into a completed state by invoking any of the following methods:
cancel()
, failed(Exception)
, or completed(Object)
.- Since:
- 4.2
-
Field Details
-
callback
-
completed
private volatile boolean completed -
cancelled
private volatile boolean cancelled -
result
-
ex
-
-
Constructor Details
-
BasicFuture
-
-
Method Details
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<T>
-
isDone
public boolean isDone() -
getResult
- Throws:
ExecutionException
-
get
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
completed
-
failed
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
cancel
public boolean cancel()Description copied from interface:Cancellable
Cancels the ongoing operation or process.- Specified by:
cancel
in interfaceCancellable
- Returns:
true
if the operation or process has been cancelled as a result of this method call orfalse
if it has already been cancelled or not started.
-