package org.kodejava.lang.management;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
public class PeakThreadCount {
public static void main(String[] args) {
// Get the managed bean for the thread system of the Java
// virtual machine.
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
// Get the peak live thread count since the Java virtual
// machine started or peak was reset.
int peakThreadCount = bean.getPeakThreadCount();
System.out.println("Peak Thread Count = " + peakThreadCount);
}
}
Latest posts by Wayan (see all)
- How do I get number of each day for a certain month in Java? - September 8, 2024
- How do I get operating system process information using ProcessHandle? - July 22, 2024
- How do I sum a BigDecimal property of a list of objects using Java Stream API? - July 22, 2024