Package org.asynchttpclient
Class ListenableFuture.CompletedFailure<T>
- java.lang.Object
-
- org.asynchttpclient.ListenableFuture.CompletedFailure<T>
-
- All Implemented Interfaces:
Future<T>
,ListenableFuture<T>
- Enclosing interface:
- ListenableFuture<V>
public static class ListenableFuture.CompletedFailure<T> extends Object implements ListenableFuture<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.asynchttpclient.ListenableFuture
ListenableFuture.CompletedFailure<T>
-
-
Constructor Summary
Constructors Constructor Description CompletedFailure(String message, Throwable t)
CompletedFailure(Throwable t)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort(Throwable t)
ListenableFuture<T>
addListener(Runnable listener, Executor exec)
Adds a listener and executor to the ListenableFuture.boolean
cancel(boolean mayInterruptIfRunning)
void
done()
Terminate and if there is no exception, mark this Future as done and release the internal lock.T
get()
T
get(long timeout, TimeUnit unit)
boolean
isCancelled()
boolean
isDone()
CompletableFuture<T>
toCompletableFuture()
void
touch()
Touch the current instance to prevent external service to times out.
-
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceFuture<T>
-
get
public T get() throws ExecutionException
- Specified by:
get
in interfaceFuture<T>
- Throws:
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws ExecutionException
- Specified by:
get
in interfaceFuture<T>
- Throws:
ExecutionException
-
done
public void done()
Description copied from interface:ListenableFuture
Terminate and if there is no exception, mark this Future as done and release the internal lock.- Specified by:
done
in interfaceListenableFuture<T>
-
abort
public void abort(Throwable t)
Description copied from interface:ListenableFuture
- Specified by:
abort
in interfaceListenableFuture<T>
- Parameters:
t
- the exception
-
touch
public void touch()
Description copied from interface:ListenableFuture
Touch the current instance to prevent external service to times out.- Specified by:
touch
in interfaceListenableFuture<T>
-
addListener
public ListenableFuture<T> addListener(Runnable listener, Executor exec)
Description copied from interface:ListenableFuture
Adds a listener and executor to the ListenableFuture. The listener will be passed to the executor for execution when theFuture
's computation is complete.
Executor can benull
, in that case executor will be executed in the thread where completion happens.
There is no guaranteed ordering of execution of listeners, they may get called in the order they were added and they may get called out of order, but any listener added through this method is guaranteed to be called once the computation is complete.- Specified by:
addListener
in interfaceListenableFuture<T>
- Parameters:
listener
- the listener to run when the computation is complete.exec
- the executor to run the listener in.- Returns:
- this Future
-
toCompletableFuture
public CompletableFuture<T> toCompletableFuture()
- Specified by:
toCompletableFuture
in interfaceListenableFuture<T>
-
-