public interface ListenableFuture<V> extends Future<V>
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.
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Runnable listener,
Executor executor)
Registers a listener to be run.
|
void addListener(@Nonnull Runnable listener, @Nonnull Executor executor)
Future'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 during Executor.execute(Runnable)
(e.g., a RejectedExecutionException or an exception thrown by direct execution) will be caught and
logged.listener - the listener to execute.executor - the executor to run the listener in.Copyright © 2004–2018. All rights reserved.