KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > container > monitor > jvm > v15 > TestJVMManagement


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

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 /**
11  * Thu, May 15, 2003 @
12  * @author: Tuan Nguyen
13  * @version: $Id: TestPortalMonitorService.java,v 1.5 2004/07/24 16:34:05 tuan08 Exp $
14  * @since: 0.0
15  * @email: tuan08@yahoo.com
16  */

17 public class TestJVMManagement extends BasicTestCase {
18
19   public TestJVMManagement(String JavaDoc 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