0
我使用的ScheduledThreadPoolExecutor:我可以知道在ScheduledThreadPoolExecutor中等待執行的任務數量嗎?
threadPoolEx = new ScheduledThreadPoolExecutor(limit);
我想知道任務的數量等待執行,或者只是爲了知道是否有等待(不一定是數字)的任何任務。
我該怎麼做? 謝謝。
我使用的ScheduledThreadPoolExecutor:我可以知道在ScheduledThreadPoolExecutor中等待執行的任務數量嗎?
threadPoolEx = new ScheduledThreadPoolExecutor(limit);
我想知道任務的數量等待執行,或者只是爲了知道是否有等待(不一定是數字)的任何任務。
我該怎麼做? 謝謝。
ScheduledThreadPoolExecutor
有一個getQueue()
方法,您可以使用。您可以查詢有關等待任務的各種信息(例如getQueue().getSize()
)。