ExecutorService中的活动线程 [英] Active threads in ExecutorService
本文介绍了ExecutorService中的活动线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何想法如何确定 ExecutorService
?
Any ideas how to determine the number of active threads currently running in an ExecutorService
?
推荐答案
使用 getActiveCount():
int getActiveCount()
// Returns the approximate number of threads that are actively executing tasks.
ExecutorService接口没有为此提供方法,它取决于实现.
The ExecutorService interface does not provide a method for that, it depends on the implementation.
这篇关于ExecutorService中的活动线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文