7
は、単純なタスク5秒ごとに実行しますScheduledThreadPoolExecutor
の次のような構成である原因ScheduledThreadPoolExecutor
は常に1つのCPUコアに100%の負荷を与えます。プール内の1つのスレッドがまだあるcorePoolSize = 1
でScheduledThreadPoolExecutorのは、与えられた1つのCPUコアに100%負荷
"pool-1-thread-1" - Thread [email protected]
java.lang.Thread.State: RUNNABLE
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.poll(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
: は、スレッドダンプを調査すると、次のスタックトレースを明らかにする。しかし、スレッドは基本的には常に状態TIMED_WAITING
にあり、したがってアイドル状態です。
ScheduledThreadPoolExecutor
の動作はcorePoolSize = 0
と既知の機能、未確認の誤った設定、またはバグですか?