ListenableFuture which forwards all its method calls to another future. Subclasses
should override one or more methods to modify the behavior of the backing future as desired per
the decorator pattern.
Most subclasses can just use SimpleForwardingListenableFuture.
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | ForwardingListenableFuture.
A simplified version of |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | addListener(Runnable
the listener to run when the computation is complete listener, Executor the executor to run the listener in exec)Implements com. |
| protected abstract ListenableFuture | delegate()
Implements abstract com. |
| ForwardingListenableFuture | back to summary |
|---|---|
| protected ForwardingListenableFuture() Constructor for use by subclasses. | |
| addListener | back to summary |
|---|---|
| public void addListener(Runnable listener, Executor exec) Implements com. Doc from com. Registers a listener to be run on the given executor.
The listener will run when the 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 Note If your listener is lightweight -- and will not cause stack overflow by completing
more futures or adding more This is the most general listener interface. For common operations performed using
listeners, see Memory consistency effects: Actions in a thread prior to adding a listener happen-before its execution begins, perhaps in another thread. Guava implementations of | |
| delegate | back to summary |
|---|---|
| protected abstract ListenableFuture Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |
ForwardingListenableFuture where subclasses can pass in an
already constructed ListenableFuture as the delegate.
| Modifier and Type | Field and Description |
|---|---|
| private final ListenableFuture |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected final ListenableFuture | delegate()
Implements abstract com. |
| delegate | back to summary |
|---|---|
| private final ListenableFuture<V> delegate | |
| SimpleForwardingListenableFuture | back to summary |
|---|---|
| protected SimpleForwardingListenableFuture(ListenableFuture<V> delegate) | |
| delegate | back to summary |
|---|---|
| protected final ListenableFuture Implements abstract com. Doc from com. Returns the backing delegate instance that methods are forwarded to. Abstract subclasses
generally override this method with an abstract method that has a more specific return type,
such as
| |