可以使用ThreadPoolExecutor以下方法:
getTaskCount() Returns the approximate total number of tasks that have ever been scheduled for execution.
getCompletedTaskCount() Returns the approximate total number of tasks that have completed execution. 返回結(jié)果少于getTaskCount()。
getLargestPoolSize() Returns the largest number of threads that have ever simultaneously been in the pool. 返回結(jié)果小于等于maximumPoolSize
getPoolSize() Returns the current number of threads in the pool
getActiveCount() Returns the approximate number of threads that are actively executing tasks