1 23 24 29 30 package com.sun.enterprise.admin.mbeans.jvm; 31 32 import com.sun.enterprise.util.i18n.StringManager; 33 import java.lang.management.ClassLoadingMXBean ; 34 import java.lang.management.CompilationMXBean ; 35 import java.lang.management.ManagementFactory ; 36 import javax.management.MBeanServerConnection ; 37 38 40 class ClassReporter { 41 42 private final MBeanServerConnection mbsc; 43 private final StringManager sm = StringManager.getManager(ClassReporter.class); 44 public ClassReporter(final MBeanServerConnection mbsc) { 45 this.mbsc = mbsc; 46 } 47 public String getClassReport() throws RuntimeException { 48 try { 49 final StringBuilderNewLineAppender sb = new StringBuilderNewLineAppender(new StringBuilder ()); 50 final ClassLoadingMXBean clmb = ManagementFactory.newPlatformMXBeanProxy(mbsc, 51 ManagementFactory.CLASS_LOADING_MXBEAN_NAME, ClassLoadingMXBean .class); 52 sb.append(sm.getString("classloading.info")); 53 sb.append(sm.getString("classes.loaded", clmb.getLoadedClassCount())); 54 sb.append(sm.getString("classes.total", clmb.getTotalLoadedClassCount())); 55 sb.append(sm.getString("classes.unloaded", clmb.getUnloadedClassCount())); 56 57 final CompilationMXBean cmb = ManagementFactory.newPlatformMXBeanProxy(mbsc, 58 ManagementFactory.COMPILATION_MXBEAN_NAME, CompilationMXBean .class); 59 sb.append(sm.getString("complilation.info")); 60 sb.append(sm.getString("compilation.monitor.status", cmb.isCompilationTimeMonitoringSupported())); 61 sb.append(sm.getString("jit.compilar.name", cmb.getName())); 62 sb.append(sm.getString("compilation.time", JVMInformationCollector.millis2HoursMinutesSeconds(cmb.getTotalCompilationTime()))); 63 return ( sb.toString() ); 64 } catch(final Exception e) { 65 throw new RuntimeException (e); 66 } 67 } 68 } | Popular Tags |