Package org.jenkinsci.remoting.util
Interface ListenableFuture<V>
- All Known Implementing Classes:
SettableFuture
Extend
Future
with the capability to accept completion callbacks. If the future has completed when the
callback is
added, the callback is triggered immediately.
Inspired by com.google.common.util.concurrent.ListenableFuture
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Runnable listener, Executor executor) Registers a listener to be run.
-
Method Details
-
addListener
Registers a listener to be run. The listener will be run on the specified executor either when theFuture
's computation is complete or, if the computation is already complete, immediately. There is no guaranteed ordering of execution of listeners, but any listener added through this method is guaranteed to be called once the computation is complete. Exceptions thrown by a listener will be propagated up to the executor. Any exception thrown duringExecutor.execute(Runnable)
(e.g., aRejectedExecutionException
or an exception thrown by direct execution) will be caught and logged.- Parameters:
listener
- the listener to execute.executor
- the executor to run the listener in.
-