クラスjava.util.concurrent.ThreadPoolExecutor
の使用
ThreadPoolExecutorを使用するパッケージ
-
java.util.concurrentでの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の効果を保持します。