Package org.asynchttpclient
Interface ListenableFuture<V>
-
- Type Parameters:
V
- Type of the value that will be returned.
- All Superinterfaces:
Future<V>
- All Known Implementing Classes:
ListenableFuture.CompletedFailure
,NettyResponseFuture
public interface ListenableFuture<V> extends Future<V>
ExtendedFuture
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ListenableFuture.CompletedFailure<T>
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abort(Throwable t)
ListenableFuture<V>
addListener(Runnable listener, Executor exec)
Adds a listener and executor to the ListenableFuture.void
done()
Terminate and if there is no exception, mark this Future as done and release the internal lock.CompletableFuture<V>
toCompletableFuture()
void
touch()
Touch the current instance to prevent external service to times out.
-
-
-
Method Detail
-
done
void done()
Terminate and if there is no exception, mark this Future as done and release the internal lock.
-
abort
void abort(Throwable t)
- Parameters:
t
- the exception
-
touch
void touch()
Touch the current instance to prevent external service to times out.
-
addListener
ListenableFuture<V> addListener(Runnable listener, Executor exec)
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.- Parameters:
listener
- the listener to run when the computation is complete.exec
- the executor to run the listener in.- Returns:
- this Future
-
toCompletableFuture
CompletableFuture<V> toCompletableFuture()
-
-