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

JVMMemoryStatsImpl

public class JVMMemoryStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.JVMMemoryStats

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
initHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
usedHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
commitHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
initNonHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxNonHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
usedNonHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
commitNonHeapSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
objPendingCount
private MemoryUsage
heapUsage
private MemoryUsage
nonheapUsage
private MemoryMXBean
bean
private static final String
BYTE_UNITS
private static final com.sun.enterprise.util.i18n.StringManager
localStrMgr
Constructors Summary
public JVMMemoryStatsImpl()
Creates a new instance of JVMMemoryStatsImpl



           
      
        
        try {
            baseStatsImpl = new GenericStatsImpl(STATS_INTERFACE_NAME, this);
        } catch(Exception e) {
            
        }
        bean = ManagementFactory.getMemoryMXBean();
        heapUsage = bean.getHeapMemoryUsage();
        nonheapUsage = bean.getNonHeapMemoryUsage();
        
        // initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetCommittedHeapSize()

        commitHeapSize.setCount(heapUsage.getCommitted());
        return (CountStatistic)commitHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCommittedNonHeapSize()

        commitNonHeapSize.setCount(nonheapUsage.getCommitted());
        return (CountStatistic)commitNonHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetInitHeapSize()

        initHeapSize.setCount(heapUsage.getInit());
        return (CountStatistic)initHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetInitNonHeapSize()

        initNonHeapSize.setCount(nonheapUsage.getCommitted());
        return (CountStatistic)initNonHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxHeapSize()

        maxHeapSize.setCount(heapUsage.getMax());
        return (CountStatistic)maxHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxNonHeapSize()

        maxNonHeapSize.setCount(nonheapUsage.getInit());
        return (CountStatistic)maxNonHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetObjectPendingFinalizationCount()

        objPendingCount.setCount(bean.getObjectPendingFinalizationCount());
        return (CountStatistic)objPendingCount.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.CountStatisticgetUsedHeapSize()

        usedHeapSize.setCount(heapUsage.getUsed());
        return (CountStatistic)usedHeapSize.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetUsedNonHeapSize()

        usedNonHeapSize.setCount(nonheapUsage.getUsed());
        return (CountStatistic)usedNonHeapSize.unmodifiableView();
    
private voidinitializeStatistics()

        String bytes_str = localStrMgr.getString(BYTE_UNITS);

        // Initialize the MutableCountStatistic for InitialHeapSize
        CountStatistic c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.initial_heap_size"), bytes_str,
            localStrMgr.getString("monitor.stats.initial_heap_size_desc"));
        initHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for MaxHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.max_heap_size"), bytes_str,
            localStrMgr.getString("monitor.stats.max_heap_size_desc"));
        maxHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for UsedHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.used_heap_size"), bytes_str,
            localStrMgr.getString("monitor.stats.used_heap_size_desc"));
        usedHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for CommittedHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.committed_heap_size"), bytes_str,
            localStrMgr.getString("monitor.stats.committed_heap_size_desc"));
        commitHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for InitialNonHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.initial_non_heap_size"), bytes_str,
            localStrMgr.getString("monitor.stats.initial_non_heap_size_desc"));
        initNonHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for MaxNonHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.max_non_heap_size"),bytes_str,
            localStrMgr.getString("monitor.stats.max_non_heap_size_desc"));
        maxNonHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for UsedNonHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.used_non_heap_size") ,bytes_str,
            localStrMgr.getString("monitor.stats.used_non_heap_size_desc"));
        usedNonHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for CommittedNonHeapSize
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.committed_non_heap_size"),
            bytes_str,
            localStrMgr.getString("monitor.stats.committed_non_heap_size_desc"));
        commitNonHeapSize = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for ObjectsPendingFinalization
        c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.objs_pending_serialization"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.objs_pending_serialization_desc"));
        objPendingCount = new MutableCountStatisticImpl(c);