1 22 package org.jboss.management.j2ee; 23 24 import org.jboss.management.j2ee.statistics.JVMStatsImpl; 25 26 import javax.management.MalformedObjectNameException ; 27 import javax.management.ObjectName ; 28 import javax.management.j2ee.statistics.Stats ; 29 import java.util.Hashtable ; 30 31 39 public class JVM extends J2EEManagedObject 40 implements JVMMBean 41 { 42 44 46 private String javaVendor; 47 private String javaVersion; 48 private String node; 49 private JVMStatsImpl stats; 50 51 53 55 57 public JVM(String name, ObjectName j2eeServer, String javaVersion, 58 String javaVendor, String node) 59 throws MalformedObjectNameException , 60 InvalidParentException 61 { 62 super(J2EETypeConstants.JVM, name, j2eeServer); 63 this.javaVendor = javaVendor; 64 this.javaVersion = javaVersion; 65 this.node = node; 66 this.stats = new JVMStatsImpl(); 67 } 68 69 71 74 public String getjavaVendor() 75 { 76 return javaVendor; 77 } 78 79 82 public String getjavaVersion() 83 { 84 return javaVersion; 85 } 86 87 90 public String getnode() 91 { 92 return node; 93 } 94 95 102 public Stats getstats() 103 { 104 stats.getUpTime(); 106 stats.getHeapSize(); 107 return stats; 108 } 109 110 115 public void resetStats() 116 { 117 stats.reset(); 118 } 119 121 123 public String toString() 124 { 125 StringBuffer tmp = new StringBuffer ("JVM"); 126 tmp.append('['); 127 tmp.append("JavaVendor: "); 128 tmp.append(javaVendor); 129 tmp.append(", JavaVersion: "); 130 tmp.append(javaVersion); 131 tmp.append(", JavaVersion: "); 132 tmp.append(javaVendor); 133 tmp.append(", Stats: "); 134 tmp.append(stats); 135 tmp.append(']'); 136 return tmp.toString(); 137 } 138 139 141 144 protected Hashtable getParentKeys(ObjectName pParent) 145 { 146 Hashtable lReturn = new Hashtable (); 147 Hashtable lProperties = pParent.getKeyPropertyList(); 148 lReturn.put(J2EETypeConstants.J2EEServer, lProperties.get("name")); 149 150 return lReturn; 151 } 152 153 } 154 | Popular Tags |