T
- The result type returned by the get()
methods
and the return type of various CompletionStage
operations.public class CompletionStageFuture<T>
extends java.lang.Object
implements java.util.concurrent.CompletionStage<T>, java.util.concurrent.Future<T>
Future
and CompletionStage
abstractions for binding clients.
Clients can consume the result of operation invocations as traditional
blocking future or use it in event driven way through the CompletionStage
.
This class delegates its functionality to CompletableFuture
.
Constructor and Description |
---|
CompletionStageFuture(java.util.concurrent.CompletableFuture<T> future) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletionStage<java.lang.Void> |
acceptEither(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Consumer<? super T> action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Consumer<? super T> action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Consumer<? super T> action,
java.util.concurrent.Executor executor) |
<U> java.util.concurrent.CompletionStage<U> |
applyToEither(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Function<? super T,U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Function<? super T,U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other,
java.util.function.Function<? super T,U> fn,
java.util.concurrent.Executor executor) |
boolean |
cancel(boolean mayInterruptIfRunning) |
java.util.concurrent.CompletionStage<T> |
exceptionally(java.util.function.Function<java.lang.Throwable,? extends T> fn) |
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
<U> java.util.concurrent.CompletionStage<U> |
handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn,
java.util.concurrent.Executor executor) |
boolean |
isCancelled() |
boolean |
isDone() |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterBoth(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterBothAsync(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterBothAsync(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action,
java.util.concurrent.Executor executor) |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterEither(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other,
java.lang.Runnable action,
java.util.concurrent.Executor executor) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenAccept(java.util.function.Consumer<? super T> action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenAcceptAsync(java.util.function.Consumer<? super T> action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenAcceptAsync(java.util.function.Consumer<? super T> action,
java.util.concurrent.Executor executor) |
<U> java.util.concurrent.CompletionStage<java.lang.Void> |
thenAcceptBoth(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiConsumer<? super T,? super U> action) |
<U> java.util.concurrent.CompletionStage<java.lang.Void> |
thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiConsumer<? super T,? super U> action) |
<U> java.util.concurrent.CompletionStage<java.lang.Void> |
thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiConsumer<? super T,? super U> action,
java.util.concurrent.Executor executor) |
<U> java.util.concurrent.CompletionStage<U> |
thenApply(java.util.function.Function<? super T,? extends U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
thenApplyAsync(java.util.function.Function<? super T,? extends U> fn) |
<U> java.util.concurrent.CompletionStage<U> |
thenApplyAsync(java.util.function.Function<? super T,? extends U> fn,
java.util.concurrent.Executor executor) |
<U,V> java.util.concurrent.CompletionStage<V> |
thenCombine(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends V> fn) |
<U,V> java.util.concurrent.CompletionStage<V> |
thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends V> fn) |
<U,V> java.util.concurrent.CompletionStage<V> |
thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends V> fn,
java.util.concurrent.Executor executor) |
<U> java.util.concurrent.CompletionStage<U> |
thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn) |
<U> java.util.concurrent.CompletionStage<U> |
thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn) |
<U> java.util.concurrent.CompletionStage<U> |
thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn,
java.util.concurrent.Executor executor) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenRun(java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenRunAsync(java.lang.Runnable action) |
java.util.concurrent.CompletionStage<java.lang.Void> |
thenRunAsync(java.lang.Runnable action,
java.util.concurrent.Executor executor) |
java.util.concurrent.CompletableFuture<T> |
toCompletableFuture()
Returns the
CompletableFuture delegate used to
implement this CompletionStageFuture . |
java.util.concurrent.CompletionStage<T> |
whenComplete(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action) |
java.util.concurrent.CompletionStage<T> |
whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action) |
java.util.concurrent.CompletionStage<T> |
whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action,
java.util.concurrent.Executor executor) |
public CompletionStageFuture(java.util.concurrent.CompletableFuture<T> future)
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
public T get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public <U> java.util.concurrent.CompletionStage<U> thenApply(java.util.function.Function<? super T,? extends U> fn)
thenApply
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> thenApplyAsync(java.util.function.Function<? super T,? extends U> fn)
thenApplyAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> thenApplyAsync(java.util.function.Function<? super T,? extends U> fn, java.util.concurrent.Executor executor)
thenApplyAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenAccept(java.util.function.Consumer<? super T> action)
thenAccept
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenAcceptAsync(java.util.function.Consumer<? super T> action)
thenAcceptAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenAcceptAsync(java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
thenAcceptAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenRun(java.lang.Runnable action)
thenRun
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenRunAsync(java.lang.Runnable action)
thenRunAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> thenRunAsync(java.lang.Runnable action, java.util.concurrent.Executor executor)
thenRunAsync
in interface java.util.concurrent.CompletionStage<T>
public <U,V> java.util.concurrent.CompletionStage<V> thenCombine(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
thenCombine
in interface java.util.concurrent.CompletionStage<T>
public <U,V> java.util.concurrent.CompletionStage<V> thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn)
thenCombineAsync
in interface java.util.concurrent.CompletionStage<T>
public <U,V> java.util.concurrent.CompletionStage<V> thenCombineAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends V> fn, java.util.concurrent.Executor executor)
thenCombineAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<java.lang.Void> thenAcceptBoth(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
thenAcceptBoth
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<java.lang.Void> thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action)
thenAcceptBothAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<java.lang.Void> thenAcceptBothAsync(java.util.concurrent.CompletionStage<? extends U> other, java.util.function.BiConsumer<? super T,? super U> action, java.util.concurrent.Executor executor)
thenAcceptBothAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterBoth(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
runAfterBoth
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
runAfterBothAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterBothAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
runAfterBothAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> applyToEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
applyToEither
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn)
applyToEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> applyToEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Function<? super T,U> fn, java.util.concurrent.Executor executor)
applyToEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> acceptEither(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
acceptEither
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action)
acceptEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> acceptEitherAsync(java.util.concurrent.CompletionStage<? extends T> other, java.util.function.Consumer<? super T> action, java.util.concurrent.Executor executor)
acceptEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterEither(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
runAfterEither
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action)
runAfterEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<java.lang.Void> runAfterEitherAsync(java.util.concurrent.CompletionStage<?> other, java.lang.Runnable action, java.util.concurrent.Executor executor)
runAfterEitherAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> thenCompose(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
thenCompose
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn)
thenComposeAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> thenComposeAsync(java.util.function.Function<? super T,? extends java.util.concurrent.CompletionStage<U>> fn, java.util.concurrent.Executor executor)
thenComposeAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<T> exceptionally(java.util.function.Function<java.lang.Throwable,? extends T> fn)
exceptionally
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<T> whenComplete(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
whenComplete
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<T> whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action)
whenCompleteAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletionStage<T> whenCompleteAsync(java.util.function.BiConsumer<? super T,? super java.lang.Throwable> action, java.util.concurrent.Executor executor)
whenCompleteAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> handle(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
handle
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn)
handleAsync
in interface java.util.concurrent.CompletionStage<T>
public <U> java.util.concurrent.CompletionStage<U> handleAsync(java.util.function.BiFunction<? super T,java.lang.Throwable,? extends U> fn, java.util.concurrent.Executor executor)
handleAsync
in interface java.util.concurrent.CompletionStage<T>
public java.util.concurrent.CompletableFuture<T> toCompletableFuture()
CompletableFuture
delegate used to
implement this CompletionStageFuture
.toCompletableFuture
in interface java.util.concurrent.CompletionStage<T>
CompletableFuture