我正在使用ScheduledThreadPoolExecutor:
threadPoolEx = new ScheduledThreadPoolExecutor(limit);
我想知道等待执行的任务数量,或者只知道是否有任何等待任务(不一定是数字)。
我该怎么做? 感谢。
答案 0 :(得分:2)
ScheduledThreadPoolExecutor
有一个getQueue()
方法可以使用。您可以查询等待任务的各种信息(例如getQueue().getSize()
)。