クラス
java.util.concurrent.CompletableFutureの使用
-
CompletableFutureを使用しているパッケージ パッケージ 説明 java.lang Javaプログラミング言語の設計にあたり基本的なクラスを提供します。java.util.concurrent 並行プログラミングでよく使用されるユーティリティ・クラスです。jdk.incubator.http 高レベルのHTTPとWebSocket API -
-
java.langでのCompletableFutureの使用
CompletableFutureを戻すjava.langのメソッド 修飾子と型 メソッド 説明 CompletableFuture<Process>
Process. onExit()
プロセス終了のためのCompletableFuture<Process>
を返します。CompletableFuture<ProcessHandle>
ProcessHandle. onExit()
プロセスの終了のためのCompletableFuture<ProcessHandle>
を返します。 -
java.util.concurrentでのCompletableFutureの使用
CompletableFutureを返すjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 static CompletableFuture<Void>
CompletableFuture. allOf(CompletableFuture<?>... cfs)
指定されたすべてのCompletableFutureが完了したときに完了する新しいCompletableFutureを返します。static CompletableFuture<Object>
CompletableFuture. anyOf(CompletableFuture<?>... cfs)
指定されたいずれかのCompletableFutureが完了したときに同じ結果で完了する新しいCompletableFutureを返します。CompletableFuture<T>
CompletableFuture. completeAsync(Supplier<? extends T> supplier)
このCompletableFutureを、デフォルトExecutorを使用して非同期タスクから呼び出された、指定されたSupplier関数の結果で完了させます。CompletableFuture<T>
CompletableFuture. completeAsync(Supplier<? extends T> supplier, Executor executor)
指定されたExecutorを使用して非同期タスクから呼び出された、指定されたSupplier関数の結果でこのCompletableFutureを完了します。static <U> CompletableFuture<U>
CompletableFuture. completedFuture(U value)
指定された値ですでに完了している新しいCompletableFutureを返します。CompletableFuture<T>
CompletableFuture. completeOnTimeout(T value, long timeout, TimeUnit unit)
指定されたタイムアウト前に完了していない場合は、このCompletableFutureを指定された値で完了します。CompletableFuture<Void>
SubmissionPublisher. consume(Consumer<? super T> consumer)
指定したコンシューマ関数を使用して、公開されたすべてのアイテムを処理します。CompletableFuture<T>
CompletableFuture. copy()
正常に完了したときにこのCompletableFutureと同じ値で正常に完了する新しいCompletableFutureを返します。CompletableFuture<T>
CompletableFuture. exceptionally(Function<Throwable,? extends T> fn)
このCompletableFutureが完了したときに完了する新しいCompletableFutureを返します。例外で完了した場合は、このCompletableFutureの完了をトリガーした例外の指定された関数の結果を含みます。このCompletableFutureが正常に完了した場合は、返されるCompletableFutureも同じ値で正常に完了します。static <U> CompletableFuture<U>
CompletableFuture. failedFuture(Throwable ex)
指定された例外を使ってすでに例外的に完了している新しいCompletableFutureを返します。<U> CompletableFuture<U>
CompletableFuture. newIncompleteFuture()
CompletionStageメソッドによって返される型の新しいCompletableFutureを返します。CompletableFuture<T>
CompletableFuture. orTimeout(long timeout, TimeUnit unit)
例外的に、このCompletableFutureをTimeoutException
で完了します(指定されたタイムアウト前に完了していない場合)。static CompletableFuture<Void>
CompletableFuture. runAsync(Runnable runnable)
ForkJoinPool.commonPool()
で実行されているタスクが指定されたアクションの実行後に非同期に完了する新しいCompletableFutureを返します。static CompletableFuture<Void>
CompletableFuture. runAsync(Runnable runnable, Executor executor)
指定されたエグゼキュータで実行されているタスクが指定されたアクションの実行後に非同期に完了する新しいCompletableFutureを返します。static <U> CompletableFuture<U>
CompletableFuture. supplyAsync(Supplier<U> supplier)
ForkJoinPool.commonPool()
で実行されているタスクが指定されたサプライヤを呼び出して取得した値を使用して非同期的に完了する新しいCompletableFutureを返します。static <U> CompletableFuture<U>
CompletableFuture. supplyAsync(Supplier<U> supplier, Executor executor)
指定されたエグゼキュータで実行されているタスクが指定されたサプライヤを呼び出して取得した値を使用して非同期的に完了する新しいCompletableFutureを返します。CompletableFuture<T>
CompletableFuture. toCompletableFuture()
このCompletableFutureを返します。CompletableFuture<T>
CompletionStage. toCompletableFuture()
このステージと同じ完了プロパティを保持するCompletableFuture
を返します。CompletableFuture型のパラメータを持つjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 static CompletableFuture<Void>
CompletableFuture. allOf(CompletableFuture<?>... cfs)
指定されたすべてのCompletableFutureが完了したときに完了する新しいCompletableFutureを返します。static CompletableFuture<Object>
CompletableFuture. anyOf(CompletableFuture<?>... cfs)
指定されたいずれかのCompletableFutureが完了したときに同じ結果で完了する新しいCompletableFutureを返します。 -
jdk.incubator.httpでのCompletableFutureの使用
CompletableFutureを戻すjdk.incubator.httpのメソッド 修飾子と型 メソッド 説明 CompletableFuture<WebSocket>
WebSocket.Builder. buildAsync(URI uri, WebSocket.Listener listener)
指定されたURI
に接続され、指定されたListener
に関連付けられたWebSocket
を構築します。CompletableFuture<U>
HttpResponse.MultiSubscriber. completion(CompletableFuture<Void> onComplete, CompletableFuture<Void> onFinalPushPromise)
集計結果オブジェクト自体が利用可能な場合に完了するCompletableFuture
<U>
を返します。abstract <T> CompletableFuture<HttpResponse<T>>
HttpClient. sendAsync(HttpRequest req, HttpResponse.BodyHandler<T> responseBodyHandler)
このクライアントと指定されたレスポンス・ハンドラを使用して、指定されたリクエストを非同期的に送信します。abstract <U,T> CompletableFuture<U>
HttpClient. sendAsync(HttpRequest req, HttpResponse.MultiSubscriber<U,T> multiSubscriber)
このクライアントと指定されたマルチ・レスポンス・ハンドラを使用して、指定されたリクエストを非同期に送信します。CompletableFuture<WebSocket>
WebSocket. sendBinary(ByteBuffer message, boolean isLast)
指定されたByteBuffer
からバイナリ・メッセージをバイト数で送信します。CompletableFuture<WebSocket>
WebSocket. sendClose(int statusCode, String reason)
指定されたステータス・コードと理由でCloseメッセージを送信し、正常終了を開始します。CompletableFuture<WebSocket>
WebSocket. sendPing(ByteBuffer message)
指定されたByteBuffer
からバイト数のPingメッセージを送信します。CompletableFuture<WebSocket>
WebSocket. sendPong(ByteBuffer message)
指定されたByteBuffer
のバイトを含むPongメッセージを送信します。CompletableFuture<WebSocket>
WebSocket. sendText(CharSequence message, boolean isLast)
指定されたCharSequence
の文字を含むテキスト・メッセージを送信します。型CompletableFutureのパラメータを持つjdk.incubator.httpのメソッド 修飾子と型 メソッド 説明 CompletableFuture<U>
HttpResponse.MultiSubscriber. completion(CompletableFuture<Void> onComplete, CompletableFuture<Void> onFinalPushPromise)
集計結果オブジェクト自体が利用可能な場合に完了するCompletableFuture
<U>
を返します。
-