1 5 package org.exoplatform.container.monitor.jvm.v15; 6 7 import java.lang.management.* ; 8 import org.exoplatform.container.RootContainer; 9 import org.exoplatform.test.BasicTestCase; 10 17 public class TestJVMManagement extends BasicTestCase { 18 19 public TestJVMManagement(String name) { 20 super(name); 21 } 22 23 public void testThreadManagement() { 24 ThreadMXBean threadBean = 25 (ThreadMXBean)RootContainer.getComponent(ThreadMXBean.class) ; 26 if(threadBean == null) return ; 27 ThreadInfo[] infos = threadBean.getThreadInfo(threadBean.getAllThreadIds()); 28 for(int i = 0; i < infos.length; i++) { 29 System.out.println("Thread Name" + infos[i].getThreadName()) ; 30 } 31 } 32 33 } 34 | Popular Tags |