BAEL4235 FindNumberOfThread class

This commit is contained in:
dev-chirag 2021-06-15 22:51:00 +05:30
parent d5f1f148e3
commit f656c61903
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package com.baeldung.concurrent.threads.number;
import java.lang.management.ManagementFactory;
public class FindNumberOfThreads {
public static void main(String[] args) {
System.out.println("Number of threads " + Thread.activeCount());
System.out.println("Current Thread Group - " + Thread.currentThread().getThreadGroup().getName());
System.out.println("Total Number of threads " + ManagementFactory.getThreadMXBean().getThreadCount());
}
}