Core API
How do I get peak live threads count?
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 […]
Article by Wayan · Source: Kode Java ↗
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);
}
}
Comments 0
Share your questions, experiences, or feedback about this article.
Sign in with Google to leave a comment.
Sign in with Google
No comments yet. Be the first to share your feedback.