FileDocCategorySizeDatePackage
PWCFileCacheStatsImpl.javaAPI DocGlassfish v2 API13299Fri May 04 22:36:08 BST 2007com.sun.enterprise.web.stats

PWCFileCacheStatsImpl

public class PWCFileCacheStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.PWCFileCacheStats
FileCache monitoring support.
author
Jeanfrancois Arcand

Fields Summary
private static final Logger
logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private ObjectName
fileCacheName
private MBeanServer
server
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
flagEnabled
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
secondsMaxAge
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countEntries
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxEntries
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countOpenEntries
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxOpenEntries
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
sizeHeapCache
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxHeapCacheSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
sizeMmapCache
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxMmapCacheSize
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countHits
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countMisses
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countInfoHits
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countInfoMisses
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countContentHits
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countContentMisses
Constructors Summary
public PWCFileCacheStatsImpl(String domain)

    
    
       
        
        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.PWCFileCacheStats.class,
            this);
        
        // get an instance of the MBeanServer
        ArrayList servers = MBeanServerFactory.findMBeanServer(null);
        if(!servers.isEmpty())
            server = (MBeanServer)servers.get(0);
        else
            server = MBeanServerFactory.createMBeanServer();
        
        String objNameStr = domain + ":type=PWCFileCache,*";
        try {
            fileCacheName = new ObjectName(objNameStr);
        } catch (Throwable t) {
            String msg = logger.getResourceBundle().getString(
                                    "webcontainer.objectNameCreationError");
            msg = MessageFormat.format(msg, new Object[] { objNameStr });
            logger.log(Level.SEVERE, msg, t);
        }

        // initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
private final intgetAggregateInt(java.lang.String attribute)
Get Aggregated int statistics.

        return StatsUtil.getAggregateStatistic(server,fileCacheName,attribute);
    
private final longgetAggregateLong(java.lang.String attribute)
Get Aggregated long statistics.

        return StatsUtil.
                getAggregateLongStatistic(server,fileCacheName,attribute);
    
public javax.management.j2ee.statistics.CountStatisticgetCountContentHits()
Return the Number of hits on cached file content

        countContentHits.setCount(getAggregateLong("countContentHits"));
        return (CountStatistic)countContentHits.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountContentMisses()
Return the Number of misses on cached file content

        countContentMisses.setCount(getAggregateLong("countContentMisses"));
        return (CountStatistic)countContentMisses.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountEntries()
Return the number of current cache entries.

        countEntries.setCount(getAggregateLong("countEntries"));
        return (CountStatistic)countEntries.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountHits()
Return he Number of cache lookup hits

        countHits.setCount(getAggregateLong("countHits"));
        return (CountStatistic)countHits.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountInfoHits()
Return the Number of hits on cached file info

        countInfoHits.setCount(getAggregateLong("countInfoHits"));
        return (CountStatistic)countInfoHits.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountInfoMisses()
The Number of misses on cached file info

return
misses on cache file info

        countInfoMisses.setCount(getAggregateLong("countInfoMisses"));
        return (CountStatistic)countInfoMisses.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountMisses()
Return the Number of cache lookup misses

        countMisses.setCount(getAggregateLong("countMisses"));
        return (CountStatistic)countMisses.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetCountOpenEntries()
Return the number of current open cache entries

return
open cache entries

        countOpenEntries.setCount(getAggregateLong("countOpenEntries"));
        return (CountStatistic)countOpenEntries.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetFlagEnabled()
Returns flag indicating whether file cache has been enabled

return
1 if file cache has been enabled, 0 otherwise

        flagEnabled.setCount(
            StatsUtil.getMaxStatistic(server, fileCacheName,"flagEnabled"));
        return (CountStatistic)flagEnabled.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetMaxEntries()
Return the maximum number of cache entries

        maxEntries.setCount(
                StatsUtil.getMaxStatistic(server, fileCacheName,"maxEntries"));
        return (CountStatistic)maxEntries.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetMaxHeapCacheSize()
Return he Maximum heap space used for cache

        maxHeapCacheSize.setCount(
            StatsUtil.getMaxLongStatistic(server, 
                fileCacheName,"maxHeapCacheSize"));
        return (CountStatistic)maxHeapCacheSize.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetMaxMmapCacheSize()
Return the Maximum Memory Map size to be used for caching

        maxMmapCacheSize.setCount(
           StatsUtil.getMaxLongStatistic(server, 
                fileCacheName,"maxMmapCacheSize"));
        return (CountStatistic)maxMmapCacheSize.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetMaxOpenEntries()
The Maximum number of open cache entries

        maxOpenEntries.setCount(
            StatsUtil.getMaxStatistic(server, fileCacheName,"maxOpenEntries"));
        return (CountStatistic)maxOpenEntries.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetSecondsMaxAge()
Return the maximum age of a valid cache entry

return
cache entry maximum age

        secondsMaxAge.setCount(
          StatsUtil.getMaxStatistic(server, fileCacheName,"secondsMaxAge"));
        return (CountStatistic)secondsMaxAge.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetSizeHeapCache()
The Heap space used for cache

return
heap size

        sizeHeapCache.setCount(
            StatsUtil.getMaxLongStatistic(server, 
                fileCacheName,"sizeHeapCache"));
        return (CountStatistic)sizeHeapCache.unmodifiableView();        
    
public javax.management.j2ee.statistics.CountStatisticgetSizeMmapCache()
Return he size of Mapped memory used for caching

        sizeMmapCache.setCount(
          StatsUtil.getMaxLongStatistic(server, 
                fileCacheName,"sizeMmapCache"));
        return (CountStatistic)sizeMmapCache.unmodifiableView();        
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String str)

        return baseStatsImpl.getStatistic( str );
    
public java.lang.String[]getStatisticNames()

        return baseStatsImpl.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()
This is an implementation of the mandatory JSR77 Stats interface method. Here we simply delegate it to the GenericStatsImpl object that we have

        return baseStatsImpl.getStatistics();
    
private voidinitializeStatistics()
This method initialize statistics.

        CountStatistic cs = null;
        
        //enabled?
        cs = new CountStatisticImpl("FlagEnabled");
        flagEnabled = new MutableCountStatisticImpl( cs );

        //seconds Max Age
        cs = new CountStatisticImpl("SecondsMaxAge");
        secondsMaxAge = new MutableCountStatisticImpl( cs );

        //count entries
        cs = new CountStatisticImpl("CountEntries");
        countEntries = new MutableCountStatisticImpl( cs );

        //maxEntries
        cs = new CountStatisticImpl("MaxEntries");
        maxEntries = new MutableCountStatisticImpl( cs );

        //Open Entries
        cs = new CountStatisticImpl("CountOpenEntries");
        countOpenEntries = new MutableCountStatisticImpl( cs );

        //Max Open Entries
        cs = new CountStatisticImpl("MaxOpenEntries");
        maxOpenEntries = new MutableCountStatisticImpl( cs );

        // heap cache size
        cs = new CountStatisticImpl("SizeHeapCache");
        sizeHeapCache = new MutableCountStatisticImpl( cs );

        //max heap cache size
        cs = new CountStatisticImpl("MaxHeapCacheSize");
        maxHeapCacheSize = new MutableCountStatisticImpl( cs );

        //Mmap cache size
        cs = new CountStatisticImpl("SizeMmapCache");
        sizeMmapCache = new MutableCountStatisticImpl( cs );

        //Max Mmap cache size
        cs = new CountStatisticImpl("MaxMmapCacheSize");
        maxMmapCacheSize = new MutableCountStatisticImpl( cs );

        //count hits
        cs = new CountStatisticImpl("CountHits");
        countHits = new MutableCountStatisticImpl( cs );

        //count Misses
        cs = new CountStatisticImpl("CountMisses");
        countMisses = new MutableCountStatisticImpl( cs );

        //count Info Hits
        cs = new CountStatisticImpl("CountInfoHits");
        countInfoHits = new MutableCountStatisticImpl( cs );

        //count Info Misses
        cs = new CountStatisticImpl("CountInfoMisses");
        countInfoMisses = new MutableCountStatisticImpl( cs );

        //content hits
        cs = new CountStatisticImpl("CountContentHits");
        countContentHits = new MutableCountStatisticImpl( cs );

        //content misses
        cs = new CountStatisticImpl("CountContentMisses");
        countContentMisses = new MutableCountStatisticImpl( cs );