方法 java.lang.ThreadGroup.activeGroupCount() 返回线程组中 Activity 组数量的估计值。回复this question ,定义了 Activity 线程。但是 Activity 线程组是什么意思呢?
最佳答案
正如您所指出的,术语“Activity 线程组”出现在 javadoc 中对于ThreadGroup::activeGroupCount
。
Activity 线程组是包含至少一个 Activity 线程的ThreadGroup
。
Activity 线程是指 Thread::isAlive
返回 true
的线程。换句话说,它已经启动但尚未终止。
请注意,线程组仅真正适合调试;请参阅What is the benefit of ThreadGroup in java over creating separate threads? 。例如,enumerate
方法具有此 javadoc注意:
"Due to the inherent race condition in this method, it is recommended that the method only be used for debugging and monitoring purposes."
这也适用于“count”方法。
关于java - Java中的 Activity 线程组是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59506834/