インタフェース
java.util.concurrent.CompletionStageの使用
CompletionStageを使用するパッケージ
パッケージ
説明
HTTPクライアントおよびWebSocket API
並行プログラミングでよく使用されるユーティリティ・クラスです。
-
java.net.httpでのCompletionStageの使用
CompletionStageを返すjava.net.httpのメソッド修飾子と型メソッド説明HttpResponse.BodySubscriber.getBody()完了するとレスポンス本文オブジェクトを返すCompletionStageを返します。default CompletionStage<?> WebSocket.Listener.onBinary(WebSocket webSocket, ByteBuffer data, boolean last) バイナリ・データを受け取りました。default CompletionStage<?> WebSocket入力が閉じられたことを示すクローズ・メッセージを受け取ります。default CompletionStage<?> WebSocket.Listener.onPing(WebSocket webSocket, ByteBuffer message) Pingメッセージを受信しました。default CompletionStage<?> WebSocket.Listener.onPong(WebSocket webSocket, ByteBuffer message) Pongメッセージが受信されました。default CompletionStage<?> WebSocket.Listener.onText(WebSocket webSocket, CharSequence data, boolean last) テキスト・データを受け取りました。 -
java.util.concurrentでのCompletionStageの使用
CompletionStageを実装しているjava.util.concurrentのクラス修飾子と型クラス説明class明示的に(その値とステータスを設定して)完了できるFutureです。その完了時に発生する依存関数およびアクションをサポートし、CompletionStageとして使用できます。修飾子と型メソッド説明CompletionStage.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) thisまたは他の指定されたステージが正常に完了したときに、対応する結果とともに指定されたアクションの引数として実行される新しいCompletionStageを返します。CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。対応する結果は、指定されたアクションの引数になります。CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して、対応する結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) thisまたは指定された他のステージが正常に完了したときに、指定された関数の引数として対応する結果とともに実行される新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。対応する結果は、指定された関数の引数になります。<U> CompletionStage<U> CompletionStage.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して、対応する結果が指定された関数の引数として実行される新しいCompletionStageを返します。static <U> CompletionStage<U> CompletableFuture.completedStage(U value) 指定された値ですでに完了している新しいCompletionStageを返し、インタフェースCompletionStageのメソッドのみをサポートします。CompletionStage.exceptionally(Function<Throwable, ? extends T> fn) thisステージが例外的に完了したときに、指定された関数の引数としてthisステージの例外とともに実行される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyAsync(Function<Throwable, ? extends T> fn) thisステージが例外的に完了したときに、thisステージのデフォルトの非同期実行機能を使用して、指定された関数の引数としてthisステージの例外とともに実行される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyAsync(Function<Throwable, ? extends T> fn, Executor executor) thisステージが例外的に完了したときに、指定されたエグゼキュータを使用して、指定された関数の引数としてthisステージの例外とともに実行される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyCompose(Function<Throwable, ? extends CompletionStage<T>> fn) thisステージが例外的に完了したときに、thisステージの例外に適用される指定された関数の結果を使用して構成される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn) thisステージが例外的に完了したときに、thisステージのデフォルトの非同期実行機能を使用して、thisステージの例外に適用される指定された関数の結果を使用して構成される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) thisステージが例外的に完了したときに、指定されたエグゼキュータを使用して、thisステージの例外に適用された指定された関数の結果を使用して構成される新しいCompletionStageを返します。static <U> CompletionStage<U> CompletableFuture.failedStage(Throwable ex) 指定された例外を使って例外的にすでに完了している新しいCompletionStageを返し、インタフェースCompletionStageのメソッドのみをサポートします。<U> CompletionStage<U> CompletionStage.handle(BiFunction<? super T, Throwable, ? extends U> fn) thisステージが正常にまたは例外的に完了したときに、指定された関数の引数としてthisステージの結果および例外とともに実行される新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.handleAsync(BiFunction<? super T, Throwable, ? extends U> fn) thisステージが正常にまたは例外的に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。thisステージの結果と、指定された関数の引数としての例外があります。<U> CompletionStage<U> CompletionStage.handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) thisステージが正常にまたは例外的に完了したときに、指定されたエグゼキュータを使用して実行される新しいCompletionStageを返します。thisステージの結果と例外は、指定された関数の引数です。CompletableFuture.minimalCompletionStage()正常に完了したときに、このCompletableFutureと同じ値で正常に完了する新しいCompletionStageを返します。この値は、インタフェースCompletionStageのメソッドで定義されていない方法で個別に完了したり、使用することはできません。CompletionStage.runAfterBoth(CompletionStage<?> other, Runnable action) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterBothAsync(CompletionStage<?> other, Runnable action) thisおよび他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterEither(CompletionStage<?> other, Runnable action) thisまたは指定された他のステージが正常に完了したときに、指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterEitherAsync(CompletionStage<?> other, Runnable action) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.thenAccept(Consumer<? super T> action) thisステージが正常に完了したときに、指定されたアクションの引数としてthisステージの結果を使用して実行される新しいCompletionStageを返します。CompletionStage.thenAcceptAsync(Consumer<? super T> action) thisステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。thisステージの結果は、指定されたアクションの引数です。CompletionStage.thenAcceptAsync(Consumer<? super T> action, Executor executor) thisステージが正常に完了したときに、指定されたエグゼキュータを使用してthisステージの結果を指定されたアクションの引数として実行する新しいCompletionStageを返します。<U> CompletionStage<Void> CompletionStage.thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたアクションの引数として2つの結果とともに実行される新しいCompletionStageを返します。<U> CompletionStage<Void> CompletionStage.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thisと他の指定されたステージの両方が正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行され、2つの結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletionStage<Void> CompletionStage.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して実行され、2つの結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletionStage<U> thisステージが正常に完了したときに、指定された関数の引数としてthisステージの結果を使用して実行される新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.thenApplyAsync(Function<? super T, ? extends U> fn) thisステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。thisステージの結果は、指定された関数の引数です。<U> CompletionStage<U> CompletionStage.thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) thisステージが正常に完了したときに、指定されたエグゼキュータを使用して実行され、thisステージの結果が指定された関数の引数として実行される新しいCompletionStageを返します。<U,V> CompletionStage <V> CompletionStage.thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) thisと他の指定されたステージの両方が正常に完了したときに、指定された関数の引数として2つの結果とともに実行される新しいCompletionStageを返します。<U,V> CompletionStage <V> CompletionStage.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) thisおよび他の指定されたステージが両方とも正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。この2つの結果は、指定された関数の引数です。<U,V> CompletionStage <V> CompletionStage.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して実行され、2つの結果が指定された関数の引数として実行される新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) 指定されたファンクションによって返されたCompletionStageと同じ値で完了した新しいCompletionStageを返します。<U> CompletionStage<U> CompletionStage.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) 指定された関数によって返されたCompletionStageと同じ値で完了する新しいCompletionStageを返します。これは、thisステージのデフォルトの非同期実行機能を使用して実行されます。<U> CompletionStage<U> CompletionStage.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) 指定されたエグゼキュータを使用して実行される、指定されたファンクションによって返されたCompletionStageと同じ値で完了した新しいCompletionStageを返します。thisステージが正常に完了したときに、指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.thenRunAsync(Runnable action) thisステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.thenRunAsync(Runnable action, Executor executor) thisステージが正常に完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.whenComplete(BiConsumer<? super T, ? super Throwable> action) thisステージが完了したときに特定のアクションを実行する、thisステージと同じ結果または例外を持つ新しいCompletionStageを返します。CompletionStage.whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action) thisステージが完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する、thisステージと同じ結果または例外を持つ新しいCompletionStageを返します。CompletionStage.whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) thisステージが完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する、thisステージと同じ結果または例外を持つ新しいCompletionStageを返します。型CompletionStageのパラメータを持つjava.util.concurrentのメソッド修飾子と型メソッド説明CompletableFuture.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) CompletionStage.acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) thisまたは他の指定されたステージが正常に完了したときに、対応する結果とともに指定されたアクションの引数として実行される新しいCompletionStageを返します。CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) CompletableFuture.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。対応する結果は、指定されたアクションの引数になります。CompletionStage.acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して、対応する結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletableFuture<U> CompletableFuture.applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletionStage<U> CompletionStage.applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) thisまたは指定された他のステージが正常に完了したときに、指定された関数の引数として対応する結果とともに実行される新しいCompletionStageを返します。<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) <U> CompletionStage<U> CompletionStage.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。対応する結果は、指定された関数の引数になります。<U> CompletionStage<U> CompletionStage.applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して、対応する結果が指定された関数の引数として実行される新しいCompletionStageを返します。CompletableFuture.runAfterBoth(CompletionStage<?> other, Runnable action) CompletionStage.runAfterBoth(CompletionStage<?> other, Runnable action) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたアクションを実行する新しいCompletionStageを返します。CompletableFuture.runAfterBothAsync(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) CompletionStage.runAfterBothAsync(CompletionStage<?> other, Runnable action) thisおよび他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletableFuture.runAfterEither(CompletionStage<?> other, Runnable action) CompletionStage.runAfterEither(CompletionStage<?> other, Runnable action) thisまたは指定された他のステージが正常に完了したときに、指定されたアクションを実行する新しいCompletionStageを返します。CompletableFuture.runAfterEitherAsync(CompletionStage<?> other, Runnable action) CompletableFuture.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) CompletionStage.runAfterEitherAsync(CompletionStage<?> other, Runnable action) thisまたは他の指定されたステージが正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage.runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) thisまたは指定された他のステージが正常に完了したときに、指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。<U> CompletableFuture<Void> CompletableFuture.thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletionStage<Void> CompletionStage.thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたアクションの引数として2つの結果とともに実行される新しいCompletionStageを返します。<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> CompletionStage<Void> CompletionStage.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) thisと他の指定されたステージの両方が正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行され、2つの結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletionStage<Void> CompletionStage.thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して実行され、2つの結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U,V> CompletableFuture <V> CompletableFuture.thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,V> CompletionStage <V> CompletionStage.thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) thisと他の指定されたステージの両方が正常に完了したときに、指定された関数の引数として2つの結果とともに実行される新しいCompletionStageを返します。<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,V> CompletionStage <V> CompletionStage.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) thisおよび他の指定されたステージが両方とも正常に完了したときに、thisステージのデフォルトの非同期実行機能を使用して実行される新しいCompletionStageを返します。この2つの結果は、指定された関数の引数です。<U,V> CompletionStage <V> CompletionStage.thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) thisおよび他の指定されたステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して実行され、2つの結果が指定された関数の引数として実行される新しいCompletionStageを返します。型CompletionStageの型引数を持つjava.util.concurrentのメソッド・パラメータ修飾子と型メソッド説明CompletableFuture.exceptionallyCompose(Function<Throwable, ? extends CompletionStage<T>> fn) default CompletionStage<T> CompletionStage.exceptionallyCompose(Function<Throwable, ? extends CompletionStage<T>> fn) thisステージが例外的に完了したときに、thisステージの例外に適用される指定された関数の結果を使用して構成される新しいCompletionStageを返します。CompletableFuture.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn) CompletableFuture.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) default CompletionStage<T> CompletionStage.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn) thisステージが例外的に完了したときに、thisステージのデフォルトの非同期実行機能を使用して、thisステージの例外に適用される指定された関数の結果を使用して構成される新しいCompletionStageを返します。default CompletionStage<T> CompletionStage.exceptionallyComposeAsync(Function<Throwable, ? extends CompletionStage<T>> fn, Executor executor) thisステージが例外的に完了したときに、指定されたエグゼキュータを使用して、thisステージの例外に適用された指定された関数の結果を使用して構成される新しいCompletionStageを返します。<U> CompletableFuture<U> CompletableFuture.thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletionStage<U> CompletionStage.thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) 指定されたファンクションによって返されたCompletionStageと同じ値で完了した新しいCompletionStageを返します。<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) <U> CompletionStage<U> CompletionStage.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) 指定された関数によって返されたCompletionStageと同じ値で完了する新しいCompletionStageを返します。これは、thisステージのデフォルトの非同期実行機能を使用して実行されます。<U> CompletionStage<U> CompletionStage.thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) 指定されたエグゼキュータを使用して実行される、指定されたファンクションによって返されたCompletionStageと同じ値で完了した新しいCompletionStageを返します。