Uses of Class
java.util.concurrent.CompletableFuture
Package
Description
Provides classes that are fundamental to the design of the Java
programming language.
HTTP Client and WebSocket APIs
Utility classes commonly useful in concurrent programming.
-
Uses of CompletableFuture in java.lang
-
Uses of CompletableFuture in java.net.http
Modifier and TypeMethodDescriptionWebSocket.Builder.buildAsync
(URI uri, WebSocket.Listener listener) abstract <T> CompletableFuture
<HttpResponse<T>> HttpClient.sendAsync
(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler) Sends the given request asynchronously using this client with the given response body handler.abstract <T> CompletableFuture
<HttpResponse<T>> HttpClient.sendAsync
(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler, HttpResponse.PushPromiseHandler<T> pushPromiseHandler) Sends the given request asynchronously using this client with the given response body handler and push promise handler.WebSocket.sendBinary
(ByteBuffer data, boolean last) Sends binary data with bytes from the given buffer.Initiates an orderly closure of this WebSocket's output by sending a Close message with the given status code and the reason.WebSocket.sendPing
(ByteBuffer message) Sends a Ping message with bytes from the given buffer.WebSocket.sendPong
(ByteBuffer message) Sends a Pong message with bytes from the given buffer.WebSocket.sendText
(CharSequence data, boolean last) Sends textual data with characters from the given character sequence.Modifier and TypeMethodDescriptionvoid
HttpResponse.PushPromiseHandler.applyPushPromise
(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function<HttpResponse.BodyHandler<T>, CompletableFuture<HttpResponse<T>>> acceptor) Notification of an incoming push promise.static <T> HttpResponse.PushPromiseHandler
<T> HttpResponse.PushPromiseHandler.of
(Function<HttpRequest, HttpResponse.BodyHandler<T>> pushPromiseHandler, ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<T>>> pushPromisesMap) Returns a push promise handler that accumulates push promises, and their responses, into the given map. -
Uses of CompletableFuture in java.util.concurrent
Modifier and TypeMethodDescriptionCompletableFuture.acceptEither
(CompletionStage<? extends T> other, Consumer<? super T> action) CompletableFuture.acceptEitherAsync
(CompletionStage<? extends T> other, Consumer<? super T> action) CompletableFuture.acceptEitherAsync
(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) static CompletableFuture
<Void> CompletableFuture.allOf
(CompletableFuture<?>... cfs) Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete.static CompletableFuture
<Object> CompletableFuture.anyOf
(CompletableFuture<?>... cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result.<U> CompletableFuture
<U> CompletableFuture.applyToEither
(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletableFuture
<U> CompletableFuture.applyToEitherAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletableFuture
<U> CompletableFuture.applyToEitherAsync
(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) CompletableFuture.completeAsync
(Supplier<? extends T> supplier) Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the default executor.CompletableFuture.completeAsync
(Supplier<? extends T> supplier, Executor executor) Completes this CompletableFuture with the result of the given Supplier function invoked from an asynchronous task using the given executor.static <U> CompletableFuture
<U> CompletableFuture.completedFuture
(U value) Returns a new CompletableFuture that is already completed with the given value.CompletableFuture.completeOnTimeout
(T value, long timeout, TimeUnit unit) Completes this CompletableFuture with the given value if not otherwise completed before the given timeout.Processes all published items using the given Consumer function.CompletableFuture.copy()
Returns a new CompletableFuture that is completed normally with the same value as this CompletableFuture when it completes normally.CompletableFuture.exceptionally
(Function<Throwable, ? extends T> fn) static <U> CompletableFuture
<U> CompletableFuture.failedFuture
(Throwable ex) Returns a new CompletableFuture that is already completed exceptionally with the given exception.<U> CompletableFuture
<U> CompletableFuture.handle
(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletableFuture
<U> CompletableFuture.handleAsync
(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletableFuture
<U> CompletableFuture.handleAsync
(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) <U> CompletableFuture
<U> CompletableFuture.newIncompleteFuture()
Returns a new incomplete CompletableFuture of the type to be returned by a CompletionStage method.Exceptionally completes this CompletableFuture with aTimeoutException
if not otherwise completed before the given timeout.CompletableFuture.runAfterBoth
(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterBothAsync
(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterBothAsync
(CompletionStage<?> other, Runnable action, Executor executor) CompletableFuture.runAfterEither
(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterEitherAsync
(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterEitherAsync
(CompletionStage<?> other, Runnable action, Executor executor) static CompletableFuture
<Void> Returns a new CompletableFuture that is asynchronously completed by a task running in theForkJoinPool.commonPool()
after it runs the given action.static CompletableFuture
<Void> Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor after it runs the given action.static <U> CompletableFuture
<U> CompletableFuture.supplyAsync
(Supplier<U> supplier) Returns a new CompletableFuture that is asynchronously completed by a task running in theForkJoinPool.commonPool()
with the value obtained by calling the given Supplier.static <U> CompletableFuture
<U> CompletableFuture.supplyAsync
(Supplier<U> supplier, Executor executor) Returns a new CompletableFuture that is asynchronously completed by a task running in the given executor with the value obtained by calling the given Supplier.CompletableFuture.thenAccept
(Consumer<? super T> action) CompletableFuture.thenAcceptAsync
(Consumer<? super T> action) CompletableFuture.thenAcceptAsync
(Consumer<? super T> action, Executor executor) <U> CompletableFuture
<Void> CompletableFuture.thenAcceptBoth
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletableFuture
<Void> CompletableFuture.thenAcceptBothAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletableFuture
<Void> CompletableFuture.thenAcceptBothAsync
(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) <U> CompletableFuture
<U> <U> CompletableFuture
<U> CompletableFuture.thenApplyAsync
(Function<? super T, ? extends U> fn) <U> CompletableFuture
<U> CompletableFuture.thenApplyAsync
(Function<? super T, ? extends U> fn, Executor executor) <U,
V> CompletableFuture <V> CompletableFuture.thenCombine
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,
V> CompletableFuture <V> CompletableFuture.thenCombineAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,
V> CompletableFuture <V> CompletableFuture.thenCombineAsync
(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) <U> CompletableFuture
<U> CompletableFuture.thenCompose
(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletableFuture
<U> CompletableFuture.thenComposeAsync
(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletableFuture
<U> CompletableFuture.thenComposeAsync
(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) CompletableFuture.thenRunAsync
(Runnable action) CompletableFuture.thenRunAsync
(Runnable action, Executor executor) CompletableFuture.toCompletableFuture()
Returns this CompletableFuture.CompletionStage.toCompletableFuture()
Returns aCompletableFuture
maintaining the same completion properties as this stage.CompletableFuture.whenComplete
(BiConsumer<? super T, ? super Throwable> action) CompletableFuture.whenCompleteAsync
(BiConsumer<? super T, ? super Throwable> action) CompletableFuture.whenCompleteAsync
(BiConsumer<? super T, ? super Throwable> action, Executor executor) Modifier and TypeMethodDescriptionstatic CompletableFuture
<Void> CompletableFuture.allOf
(CompletableFuture<?>... cfs) Returns a new CompletableFuture that is completed when all of the given CompletableFutures complete.static CompletableFuture
<Object> CompletableFuture.anyOf
(CompletableFuture<?>... cfs) Returns a new CompletableFuture that is completed when any of the given CompletableFutures complete, with the same result.