FileDocCategorySizeDatePackage
JVMClassLoadingStatsImpl.javaAPI DocGlassfish v2 API6478Fri May 04 22:24:20 BST 2007com.sun.enterprise.admin.monitor.stats.spi

JVMClassLoadingStatsImpl

public class JVMClassLoadingStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.JVMClassLoadingStats

Fields Summary
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private static final String
STATS_INTERFACE_NAME
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
loadedClassCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
unloadedClassCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
totalLoadedClassCount
private ClassLoadingMXBean
bean
private static final com.sun.enterprise.util.i18n.StringManager
localStrMgr
Constructors Summary
public JVMClassLoadingStatsImpl()
Creates a new instance of JVMClassLoadingStatsImpl


    

           
      
        
        try {
            baseStatsImpl = new GenericStatsImpl(STATS_INTERFACE_NAME, this);
        } catch(Exception e) {
            
        }
        // get an instance of the MBeanServer
        // server = getPlatformMBeanServer();
        bean = ManagementFactory.getClassLoadingMXBean();
        
        // initialize all the MutableStatistic Classes
        initializeStatistics();

    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetLoadedClassCount()

        long classCount = bean.getLoadedClassCount();
        loadedClassCount.setCount (classCount);
        return (CountStatistic)loadedClassCount.unmodifiableView ();
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String str)
queries for a Statistic by name.

return
Statistic

        return baseStatsImpl.getStatistic(str);
    
public java.lang.String[]getStatisticNames()
returns an array of names of all the Statistics, that can be retrieved from this implementation of Stats

return
String[]

        return baseStatsImpl.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()
This method can be used to retrieve all the Statistics, exposed by this implementation of Stats

return
Statistic[]

        return baseStatsImpl.getStatistics();
    
public javax.management.j2ee.statistics.CountStatisticgetTotalLoadedClassCount()

        long classCount = bean.getTotalLoadedClassCount();
        totalLoadedClassCount.setCount (classCount);
        return (CountStatistic)totalLoadedClassCount.unmodifiableView ();
    
public javax.management.j2ee.statistics.CountStatisticgetUnloadedClassCount()

        long classCount = bean.getUnloadedClassCount();
        unloadedClassCount.setCount (classCount);
        return (CountStatistic)unloadedClassCount.unmodifiableView ();
    
private voidinitializeStatistics()

        
       // Initialize the MutableCountStatistic for TotalLoadedClassCount
        CountStatistic c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.total_classes_load"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.total_classes_load_desc"));
        totalLoadedClassCount = new MutableCountStatisticImpl(c);

       // Initialize the MutableCountStatistic for LoadedClassCount
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.classes_loaded"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.classes_loaded_desc"));
        loadedClassCount = new MutableCountStatisticImpl(c);

       // Initialize the MutableCountStatistic for UnLoadedClassCount
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.classes_unloaded"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.classes_unloaded_desc"));
        unloadedClassCount = new MutableCountStatisticImpl(c);