How to check the number of currently running threads in Java?
This will give you the total number of threads in your VM :
int nbThreads = Thread.getAllStackTraces().keySet().size();Now, if you want all threads currently executing, you can do that :
int nbRunning = 0;
for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getState()==Thread.State.RUNNABLE) nbRunning++;
}If you want to see running threads not programmaticaly but with a Windows tool, you could useProcess Explorer.
'java' 카테고리의 다른 글
| hssf vs xssf (0) | 2016.08.10 |
|---|---|
| setSoTimeout, connect timeout (0) | 2016.08.05 |
| ehcache 캐시와 연동하기 (0) | 2016.06.15 |
| timer schedule vs scheduleAtFixedRate (0) | 2016.06.15 |
| java.exe와 javaw.exe (0) | 2016.06.10 |