Used for implementing Future#map(Function) and Future#flatMap(Function)
Implementation Note
The operations themselves are implemented as static inner classes instead of lambdas to aid debugging.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final InternalLogger | |
| private static final Futures. | |
| private static final Futures. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static < the type of the value. V> void | |
| public static <V, The result type of the mapper function, and of the returned future. R> Future | Returns: A new future instance that will complete with the mapped result of the given future.The function that will convert the result of the given future into the result of the returned
future. mapper)Creates a new |
| public static <V, The result type of the mapper function, and of the returned future. R> Future | Returns: A new future instance that will complete with the mapped result of the given future.The future whose result will flow to the returned future, through the mapping function. future, Function<V, R> The function that will convert the result of the given future into the result of the returned
future. mapper)Creates a new |
| pack-priv static <R> FutureContextListener | |
| pack-priv static FutureContextListener | |
| pack-priv static <A, B> void |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| PASS_THROUGH | back to summary |
|---|---|
| private static final Futures. | |
| PROPAGATE_CANCEL | back to summary |
|---|---|
| private static final Futures. | |
| Futures | back to summary |
|---|---|
| private Futures() | |
| cascade | back to summary |
|---|---|
| pack-priv static <V> void cascade(final Future<V> future, final Promise<? super V> promise) Link the | |
| flatMap | back to summary |
|---|---|
| public static <V, R> Future Creates a new
The "flat" in "flat-map" means the given mapper function produces a result that itself is a future-of-R, yet this
method also returns a future-of-R, rather than a future-of-future-of-R. In other words, if the same mapper
function was used with the Effectively, this method behaves similar to this serial code, except asynchronously and with proper exception and cancellation handling:
If the given future fails, then the returned future will fail as well, with the same exception. Cancellation of either future will cancel the other. If the mapper function throws, the returned future will fail, but the given future will be unaffected.
| |
| map | back to summary |
|---|---|
| public static <V, R> Future Creates a new If the given future fails, then the returned future will fail as well, with the same exception. Cancellation of either future will cancel the other. If the mapper function throws, the returned future will fail, but the given future will be unaffected.
| |
| passThrough | back to summary |
|---|---|
pack-priv static <R> FutureContextListener
| |
| propagateCancel | back to summary |
|---|---|
pack-priv static FutureContextListener
| |
| propagateUncommonCompletion | back to summary |
|---|---|
| pack-priv static <A, B> void propagateUncommonCompletion(Future<? extends A> completed, Promise<B> recipient) | |
| Modifier and Type | Field and Description |
|---|---|
| private final Future | |
| private final Function |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public R | call()
Implements java. |
| future | back to summary |
|---|---|
| private final Future<T> future | |
| mapper | back to summary |
|---|---|
| private final Function<T, R> mapper | |
| CallableMapper | back to summary |
|---|---|
| pack-priv CallableMapper(Future<T> future, Function<T, R> mapper) | |
| call | back to summary |
|---|---|
| public R call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private final Promise |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | operationComplete(Future<?>
the source completed)Future which called this callbackImplements io. Future has been completed.
|
| mapper | back to summary |
|---|---|
| private final Function<T, Future<R>> mapper | |
| recipient | back to summary |
|---|---|
| private final Promise<R> recipient | |
| FlatMapper | back to summary |
|---|---|
| pack-priv FlatMapper(Promise<R> recipient, Function<T, Future<R>> mapper) | |
| operationComplete | back to summary |
|---|---|
| public void operationComplete(Future<?> completed) throws Exception Implements io. Doc from io. Invoked when the operation associated with the | |
| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private final Promise |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | operationComplete(Future<?>
the source completed)Future which called this callbackImplements io. Future has been completed.
|
| mapper | back to summary |
|---|---|
| private final Function<T, R> mapper | |
| recipient | back to summary |
|---|---|
| private final Promise<R> recipient | |
| Mapper | back to summary |
|---|---|
| pack-priv Mapper(Promise<R> recipient, Function<T, R> mapper) | |
| operationComplete | back to summary |
|---|---|
| public void operationComplete(Future<?> completed) throws Exception Implements io. Doc from io. Invoked when the operation associated with the | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | operationComplete(Promise<R> recipient, Future<?>
the source completed)Future which called this callbackImplements io. Future has been completed.
|
| PassThrough | back to summary |
|---|---|
| private PassThrough() | |
| operationComplete | back to summary |
|---|---|
| public void operationComplete(Promise<R> recipient, Future<?> completed) throws Exception Implements io. Doc from io. Invoked when the operation associated with the | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | operationComplete(Future<Object> context, Future<?>
the source future)Future which called this callbackImplements io. Future has been completed.
|
| PropagateCancel | back to summary |
|---|---|
| private PropagateCancel() | |
| operationComplete | back to summary |
|---|---|
| public void operationComplete(Future<Object> context, Future<?> future) throws Exception Implements io. Doc from io. Invoked when the operation associated with the | |