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

JVMOperatingSystemStatsImpl

public class JVMOperatingSystemStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.JVMOperatingSystemStats

Fields Summary
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private static final String
STATS_INTERFACE_NAME
private MBeanServer
server
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
availProcs
private com.sun.enterprise.admin.monitor.stats.StringStatistic
name
private OperatingSystemMXBean
bean
final long
initTime
private static final com.sun.enterprise.util.i18n.StringManager
localStrMgr
Constructors Summary
public JVMOperatingSystemStatsImpl()
Creates a new instance of JVMOperatingSystemStatsImpl

    

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

    
Methods Summary
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetArch()

        
        String arch = bean.getArch();
        
        return new StringStatisticImpl(arch, 
                   localStrMgr.getString("monitor.stats.arch_string"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.arch_of_os"), 
                   initTime,
                   System.currentTimeMillis()); 
    
public javax.management.j2ee.statistics.CountStatisticgetAvailableProcessors()

        long procs = bean.getAvailableProcessors();
        availProcs.setCount (procs);
        return (CountStatistic)availProcs.unmodifiableView ();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetName()

        
        String name = bean.getName();
        
        return new StringStatisticImpl(name, 
                   localStrMgr.getString("monitor.stats.name_string"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.name_of_os"), 
                   initTime,
                   System.currentTimeMillis()); 
    
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 com.sun.enterprise.admin.monitor.stats.StringStatisticgetVersion()

        
        String version = bean.getVersion();
        
        return new StringStatisticImpl(version, 
                   localStrMgr.getString("monitor.stats.vers_string"), 
                   localStrMgr.getString("monitor.stats.string_units"), 
                   localStrMgr.getString("monitor.stats.vers_of_os"), 
                   initTime,
                   System.currentTimeMillis()); 
    
private voidinitializeStatistics()

        
       // Initialize the MutableCountStatistic for AvailableProcessors
        CountStatistic c = new CountStatisticImpl(
            localStrMgr.getString("monitor.stats.avail_procs"),
            StatisticImpl.DEFAULT_UNIT,
            localStrMgr.getString("monitor.stats.avail_procs_desc"));
        availProcs = new MutableCountStatisticImpl(c);