- All Known Implementing Classes:
public interface ListenableFuture<V> extends Future<V>Extend
Futurewith the capability to accept completion callbacks. If the future has completed when the callback is added, the callback is triggered immediately.
addListenerRegisters a listener to be run. The listener will be run on the specified executor either when the
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
RejectedExecutionExceptionor an exception thrown by direct execution) will be caught and logged.
listener- the listener to execute.
executor- the executor to run the listener in.