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

PWCKeepAliveStatsImpl

public final class PWCKeepAliveStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.PWCKeepAliveStats
author
Jan Luehe

Fields Summary
private static final Logger
_logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private MBeanServer
server
private ObjectName
keepAliveName
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countConnections
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxConnections
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countHits
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countFlushes
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countRefusals
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countTimeouts
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
secondsTimeouts
Constructors Summary
public PWCKeepAliveStatsImpl(String domain)

	

       
       
        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.PWCKeepAliveStats.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=PWCKeepAlive,*";
        try {
            keepAliveName = 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
public javax.management.j2ee.statistics.CountStatisticgetCountConnections()
Gets the number of connections in keep-alive mode.

return
Number of connections in keep-alive mode

        countConnections.setCount(
            StatsUtil.getAggregateStatistic(server, keepAliveName,
                                            "countConnections"));
        return (CountStatistic)countConnections.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountFlushes()
Gets the number of keep-alive connections that were closed

return
Number of keep-alive connections that were closed

        countFlushes.setCount(
            StatsUtil.getAggregateStatistic(server, keepAliveName,
                                            "countFlushes"));
        return (CountStatistic)countFlushes.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountHits()
Gets the number of requests received by connections in keep-alive mode.

return
Number of requests received by connections in keep-alive mode.

        countHits.setCount(
            StatsUtil.getAggregateStatistic(server, keepAliveName,
                                            "countHits"));
        return (CountStatistic)countHits.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountRefusals()
Gets the number of keep-alive connections that were rejected.

return
Number of keep-alive connections that were rejected.

        countRefusals.setCount(
            StatsUtil.getAggregateStatistic(server, keepAliveName,
                                            "countRefusals"));
        return (CountStatistic)countRefusals.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountTimeouts()
Gets the number of keep-alive connections that timed out.

return
Number of keep-alive connections that timed out.

        countTimeouts.setCount(
            StatsUtil.getAggregateStatistic(server, keepAliveName,
                                            "countTimeouts"));
        return (CountStatistic)countTimeouts.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxConnections()
Gets the maximum number of concurrent connections in keep-alive mode.

return
Maximum number of concurrent connections in keep-alive mode

        maxConnections.setCount(
            StatsUtil.getConstant(server, keepAliveName, "maxConnections"));
        return (CountStatistic)maxConnections.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetSecondsTimeouts()
Gets the number of seconds before a keep-alive connection that has been idle times out and is closed.

return
Keep-alive timeout in number of seconds

        secondsTimeouts.setCount(
            StatsUtil.getConstant(server, keepAliveName, "secondsTimeouts"));
        return (CountStatistic)secondsTimeouts.unmodifiableView();
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String name)
Queries for a statistic with the given name.

name
Name of the statistic to query for
return
Statistic for the given name

        return baseStatsImpl.getStatistic(name);
    
public java.lang.String[]getStatisticNames()
Gets array of all statistic names exposed by this implementation of

return
Array of statistic names

        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();
    
private voidinitializeStatistics()

        
        CountStatistic c = null;

        c = new CountStatisticImpl("CountConnections");
        countConnections = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("MaxConnections");
        maxConnections = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountHits");
        countHits = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountFlushes");
        countFlushes = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountRefusals");
        countRefusals = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountTimeouts");
        countTimeouts = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("SecondsTimeouts");
        secondsTimeouts = new MutableCountStatisticImpl(c);