开发者

Can I know the number of tasks awaiting execution in ScheduledThreadPoolExecutor?

I am using ScheduledThreadPoolExecutor:

threadPoolEx = new ScheduledThreadPoolEx开发者_如何转开发ecutor(limit);

I want to know the number of tasks awaiting execution, or just to know if there are any tasks waiting (not necessarily the number).

How can I do that? Thanks.


ScheduledThreadPoolExecutor has a getQueue() method that you can use. You can query that for various bits of info on the waiting tasks (e.g. getQueue().getSize()).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜