Package com.ning.http.client
Interface ListenableFuture<V>
- Type Parameters:
V- Type of the value that will be returned.
- All Superinterfaces:
Future<V>
- All Known Implementing Classes:
AbstractListenableFuture,ListenableFuture.CompletedFailure
Extended
Future-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Runnable listener, Executor exec) Adds a listener and executor to the ListenableFuture.voiddone()Terminate and if there is no exception, mark this Future as done and release the internal lock.voidtouch()Touch the current instance to prevent external service to times out.
-
Method Details
-
done
void done()Terminate and if there is no exception, mark this Future as done and release the internal lock.- Parameters:
callable-
-
abort
- Parameters:
t-
-
touch
void touch()Touch the current instance to prevent external service to times out. -
addListener
Adds a listener and executor to the ListenableFuture. The listener will be passed to the executor for execution when the
Future's computation is complete.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
- Throws:
NullPointerException- if the executor or listener was null.RejectedExecutionException- if we tried to execute the listener immediately but the executor rejected it.
-