クラスjava.util.concurrent.ThreadPoolExecutor
の使用
-
ThreadPoolExecutorを使用するパッケージ パッケージ 説明 java.util.concurrent 並行プログラミングでよく使用されるユーティリティ・クラスです。 -
-
java.util.concurrentでのThreadPoolExecutorの使用
java.util.concurrentでのThreadPoolExecutorのサブクラス 修飾子と型 クラス 説明 class
ScheduledThreadPoolExecutor
指定された遅延時間後または定期的にコマンドを実行するようにスケジュールできるThreadPoolExecutor
です。ThreadPoolExecutor型のパラメータを持つjava.util.concurrentのメソッド 修飾子と型 メソッド 説明 void
RejectedExecutionHandler. rejectedExecution(Runnable r, ThreadPoolExecutor executor)
execute
がタスクを受け入れることができない場合にThreadPoolExecutor
によって呼び出される可能性のあるメソッドです。void
ThreadPoolExecutor.AbortPolicy. rejectedExecution(Runnable r, ThreadPoolExecutor e)
常にRejectedExecutionExceptionをスローします。void
ThreadPoolExecutor.CallerRunsPolicy. rejectedExecution(Runnable r, ThreadPoolExecutor e)
executorがシャットダウンしていない場合に、呼出し側のスレッドでタスクrを実行します。シャットダウンしている場合、タスクは破棄されます。void
ThreadPoolExecutor.DiscardOldestPolicy. rejectedExecution(Runnable r, ThreadPoolExecutor e)
executorがシャットダウンしないかぎり、タスクがすぐに利用可能な場合にexecutorが実行するはずの次のタスクを取得して無視し、タスクrの実行を再度試みます。シャットダウンしている場合、タスクrは破棄されます。void
ThreadPoolExecutor.DiscardPolicy. rejectedExecution(Runnable r, ThreadPoolExecutor e)
何も実行しません。これは、破棄するタスクrの効果を保持します。
-