KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > mbeans > jvm > JVMInformation


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * JVMInformation.java
26  *
27  * Created on July 20, 2005, 10:24 PM
28  */

29
30 package com.sun.enterprise.admin.mbeans.jvm;
31
32 import com.sun.enterprise.util.SystemPropertyConstants;
33 import javax.management.MBeanRegistration JavaDoc;
34 import javax.management.MBeanServer JavaDoc;
35 import javax.management.MBeanServerConnection JavaDoc;
36 import javax.management.ObjectName JavaDoc;
37
38 /**
39  */

40 public class JVMInformation implements JVMInformationMBean, MBeanRegistration JavaDoc {
41     private MBeanServerConnection JavaDoc mbsc = null;
42     /** Creates a new instance of JVMInformation */
43     public JVMInformation() {
44     }
45
46     public String JavaDoc getThreadDump(String JavaDoc processName) {
47         final ThreadMonitor tm = new ThreadMonitor(mbsc);
48         return ( tm.getThreadDump() );
49     }
50
51     public String JavaDoc getSummary(String JavaDoc processName) {
52         final SummaryReporter sr = new SummaryReporter(mbsc);
53         return ( sr.getSummaryReport() );
54     }
55
56     public String JavaDoc getMemoryInformation(String JavaDoc processName) {
57         final MemoryReporter mr = new MemoryReporter(mbsc);
58         return ( mr.getMemoryReport() );
59     }
60
61     public String JavaDoc getClassInformation(String JavaDoc processName) {
62         final ClassReporter cr = new ClassReporter(mbsc);
63         return ( cr.getClassReport() );
64     }
65
66     public void postRegister(Boolean JavaDoc registrationDone) {
67     }
68
69     public ObjectName JavaDoc preRegister(MBeanServer JavaDoc server, ObjectName JavaDoc name) throws Exception JavaDoc {
70         this.mbsc = server;
71         final String JavaDoc sn = System.getProperty(SystemPropertyConstants.SERVER_NAME);
72         final ObjectName JavaDoc on = JVMInformationCollector.formObjectName(sn, JVMInformation.class.getSimpleName());
73         return ( on );
74     }
75
76     public void preDeregister() throws Exception JavaDoc {
77     }
78
79     public void postDeregister() {
80     }
81     
82 }
83
Popular Tags