インタフェースjava.util.concurrent.Executor
の使用
| パッケージ | 説明 |
|---|---|
| com.sun.net.httpserver |
組込みのHTTPサーバーの構築に使用できる、単純で高度なHTTPサーバーAPIを提供します。
|
| java.net.http |
HTTPクライアントおよびWebSocket API
|
| java.sql |
Java™プログラミング言語を使用してデータソース(通常はリレーショナル・データベース)に格納されたデータにアクセスして処理するためのAPIを提供します。
|
| java.util.concurrent |
並行プログラミングでよく使用されるユーティリティ・クラスです。
|
| javax.management |
Java Management Extensionsのコア・クラスを提供します。
|
-
com.sun.net.httpserverでのExecutorの使用
Executorを戻すcom.sun.net.httpserverのメソッド 修飾子と型 メソッド 説明 abstract ExecutorHttpServer. getExecutor()このサーバーのexecutorオブジェクトがHttpServer.setExecutor(Executor)で指定された場合は、それを返します。何も指定されていない場合は、nullを返します。型Executorのパラメータを持つcom.sun.net.httpserverのメソッド 修飾子と型 メソッド 説明 abstract voidHttpServer. setExecutor(Executor executor)このサーバーのExecutorオブジェクトを設定します。 -
java.net.httpでのExecutorの使用
型Executorの引数を持つ型を返すjava.net.httpのメソッド 修飾子と型 メソッド 説明 abstract Optional<Executor>HttpClient. executor()このクライアントExecutorを含むOptionalを返します。型Executorのパラメータを持つjava.net.httpのメソッド 修飾子と型 メソッド 説明 HttpClient.BuilderHttpClient.Builder. executor(Executor executor)非同期および依存タスクに使用されるエグゼキュータを設定します。 -
java.sqlでのExecutorの使用
-
java.util.concurrentでのExecutorの使用
java.util.concurrentでのExecutorのサブインタフェース 修飾子と型 インタフェース 説明 interfaceExecutorServiceinterfaceScheduledExecutorService指定された遅延時間後または定期的にコマンドを実行するようにスケジュールできるExecutorServiceです。Executorを実装しているjava.util.concurrentのクラス 修飾子と型 クラス 説明 classAbstractExecutorServiceExecutorService実行メソッドのデフォルト実装を提供します。classForkJoinPoolForkJoinTaskを実行するためのExecutorService。classScheduledThreadPoolExecutor指定された遅延時間後または定期的にコマンドを実行するようにスケジュールできるThreadPoolExecutorです。classThreadPoolExecutorプールされた複数のスレッドの1つを使用して送信された各タスクを実行するExecutorServiceです。通常はExecutorsファクトリ・メソッドを使用して構成されます。Executorを戻すjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 ExecutorCompletableFuture. defaultExecutor()Executorを指定しない非同期メソッドに使用されるデフォルトのExecutorを返します。static ExecutorCompletableFuture. delayedExecutor(long delay, TimeUnit unit)指定された遅延(非正の場合は遅延なし)の後にデフォルトのexecutorにタスクをサブ・ミットする新しいExecutorを返します。static ExecutorCompletableFuture. delayedExecutor(long delay, TimeUnit unit, Executor executor)指定された遅延(非正の場合は遅延なし)の後に、指定されたベースexecutorにタスクをサブ・ミットする新しいExecutorを返します。ExecutorSubmissionPublisher. getExecutor()非同期配信に使用されるExecutorを返します。Executor型のパラメータを持つjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 CompletableFuture<Void>CompletableFuture. acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)CompletionStage<Void>CompletionStage. acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor)指定されたステージが正常に完了したときに、指定されたステージのいずれかが正常に完了したときに、指定されたエグゼキュータを使用して実行され、対応する結果が指定されたアクションの引数として返される新しいCompletionStageを返します。<U> CompletionStage<U>CompletionStage. applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T,U> fn, Executor executor)このステージまたは指定された他のステージが正常に完了したときに、対応する結果を指定されたアクションへの引数に設定し、指定されたエグゼキュータを使用して実行される新しいCompletionStageを返します。CompletableFuture<T>CompletableFuture. completeAsync(Supplier<? extends T> supplier, Executor executor)指定されたExecutorを使用して非同期タスクから呼び出された、指定されたSupplier関数の結果でこのCompletableFutureを完了します。static ExecutorCompletableFuture. delayedExecutor(long delay, TimeUnit unit, Executor executor)指定された遅延(非正の場合は遅延なし)の後に、指定されたベースexecutorにタスクをサブ・ミットする新しいExecutorを返します。default CompletionStage<T>CompletionStage. exceptionallyAsync(Function<Throwable,? extends T> fn, Executor executor)このステージが例外的に完了すると、指定されたエグゼキュータを使用して、指定された関数の引数としてこのステージ例外で実行される新しいCompletionStageを返します。default CompletionStage<T>CompletionStage. exceptionallyComposeAsync(Function<Throwable,? extends CompletionStage<T>> fn, Executor executor)新しいCompletionStageを返します。このステージが例外的に完了すると、指定されたエグゼキュータを使用して、このステージ例外に適用された指定関数の結果を使用して構成されます。<U> CompletionStage<U>CompletionStage. handleAsync(BiFunction<? super T,Throwable,? extends U> fn, Executor executor)このステージが正常終了または異常終了した際に指定されたエグゼキュータを使って実行される新しいCompletionStageを返します(実行時には、指定された関数の引数としてこのステージの結果と例外が使用される)。CompletableFuture<Void>CompletableFuture. runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)CompletionStage<Void>CompletionStage. runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor)これと他のステージが両方とも正常に完了した場合に、指定されたアクションを指定されたエグゼキュータを使用して実行する新しいCompletionStageを返します。CompletableFuture<Void>CompletableFuture. runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)CompletionStage<Void>CompletionStage. runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor)このステージと指定された他のステージのどちらかが正常に完了したときに指定されたエグゼキュータを使用して指定されたアクションを実行する新しいCompletionStageを返します。static CompletableFuture<Void>CompletableFuture. runAsync(Runnable runnable, Executor executor)指定されたexecutorで実行されているタスクが指定されたアクションの実行後に非同期に完了する新しいCompletableFutureを返します。static <U> CompletableFuture<U>CompletableFuture. supplyAsync(Supplier<U> supplier, Executor executor)指定されたエグゼキュータで実行されているタスクが指定されたサプライヤを呼び出して取得した値を使用して非同期的に完了する新しいCompletableFutureを返します。CompletableFuture<Void>CompletableFuture. thenAcceptAsync(Consumer<? super T> action, Executor executor)CompletionStage<Void>CompletionStage. thenAcceptAsync(Consumer<? super T> action, Executor executor)このステージが正常に完了したときに、このステージの結果を指定されたアクションへの引数に設定し、指定されたエグゼキュータを使用して実行される新しいCompletionStageを返します。<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, Executor executor)これと他のステージが両方とも正常に完了したときに、指定されたエグゼキュータを使用して実行され、2つの結果が指定されたアクションの引数として実行される新しいCompletionStageを返します。<U> CompletionStage<U>CompletionStage. thenApplyAsync(Function<? super T,? extends U> fn, Executor executor)このステージが正常に完了したときに、このステージの結果を指定された関数への引数に設定し、指定されたエグゼキュータを使用して実行される新しいCompletionStageを返します。<U, V> CompletionStage<V>CompletionStage. thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T,? super U,? extends V> fn, Executor executor)これと他のステージが両方とも正常に完了したときに、指定された関数の引数として2つの結果を指定して、指定されたexecutorを使用して実行される新しいCompletionStageを返します。<U> CompletionStage<U>CompletionStage. thenComposeAsync(Function<? super T,? extends CompletionStage<U>> fn, Executor executor)指定されたExecutorによって返されたCompletionStageと同じ値で完了し、指定されたExecutorを使用して実行される新しいCompletionStageを返します。CompletableFuture<Void>CompletableFuture. thenRunAsync(Runnable action, Executor executor)CompletionStage<Void>CompletionStage. thenRunAsync(Runnable action, Executor executor)このステージが正常に完了したときに指定されたExecutorを使用して指定されたアクションを実行する新しいCompletionStageを返します。CompletionStage<T>CompletionStage. whenCompleteAsync(BiConsumer<? super T,? super Throwable> action, Executor executor)このステージが完了したときに、指定されたExecutorを使用して指定されたアクションを実行するこのステージと同じ結果または例外を使用して新しいCompletionStageを返します。Executor型のパラメータを持つjava.util.concurrentのコンストラクタ コンストラクタ 説明 ExecutorCompletionService(Executor executor)基本タスクの実行用に指定されたexecutorを使用し、完了キューとしてLinkedBlockingQueueを使用して、ExecutorCompletionServiceを作成します。ExecutorCompletionService(Executor executor, BlockingQueue<Future<V>> completionQueue)基本タスクの実行用に指定されたexecutorを使用し、完了キューとして指定されたキューを使用して、ExecutorCompletionServiceを作成します。SubmissionPublisher(Executor executor, int maxBufferCapacity)指定されたExecutorを使用してサブスクライバに非同期に配信するための新しいSubmissionPublisherを作成します。各サブスクライバの最大バッファ・サイズは指定されており、メソッドonNextのサブスクライバ例外ハンドラはありません。SubmissionPublisher(Executor executor, int maxBufferCapacity, BiConsumer<? super Flow.Subscriber<? super T>,? super Throwable> handler)各サブスクライバに対して指定された最大バッファ・サイズでサブスクライバへの非同期配信用に、指定されたExecutorを使用して新しいSubmissionPublisherを作成し、非nullの場合、サブスクライバがonNextメソッドで例外をスローしたときに呼び出されます。 -
javax.managementでのExecutorの使用
Executor型のパラメータを持つjavax.managementのコンストラクタ コンストラクタ 説明 NotificationBroadcasterSupport(Executor executor)NotificationBroadcasterSupportを構築します。ここで、各リスナーは指定したExecutorを使って呼び出されます。NotificationBroadcasterSupport(Executor executor, MBeanNotificationInfo... info)送信可能な通知に関する情報を使って、NotificationBroadcasterSupportを構築します。各リスナーは、指定したExecutorを使って呼び出されます。