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 voidabort(Throwable t)ListenableFuture<T>addListener(Runnable listener, Executor exec)Adds a listener and executor to the ListenableFuture.booleancancel(boolean mayInterruptIfRunning)voiddone()Terminate and if there is no exception, mark this Future as done and release the internal lock.Tget()Tget(long timeout, TimeUnit unit)booleanisCancelled()booleanisDone()CompletableFuture<T>toCompletableFuture()voidtouch()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:
isCancelledin interfaceFuture<T>
-
get
public T get() throws ExecutionException
- Specified by:
getin interfaceFuture<T>- Throws:
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws ExecutionException
- Specified by:
getin interfaceFuture<T>- Throws:
ExecutionException
-
done
public void done()
Description copied from interface:ListenableFutureTerminate and if there is no exception, mark this Future as done and release the internal lock.- Specified by:
donein interfaceListenableFuture<T>
-
abort
public void abort(Throwable t)
Description copied from interface:ListenableFuture- Specified by:
abortin interfaceListenableFuture<T>- Parameters:
t- the exception
-
touch
public void touch()
Description copied from interface:ListenableFutureTouch the current instance to prevent external service to times out.- Specified by:
touchin interfaceListenableFuture<T>
-
addListener
public ListenableFuture<T> addListener(Runnable listener, Executor exec)
Description copied from interface:ListenableFutureAdds 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:
addListenerin 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:
toCompletableFuturein interfaceListenableFuture<T>
-
-