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

PWCConnectionQueueStatsImpl

public final class PWCConnectionQueueStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.PWCConnectionQueueStats
Implementation of PWCConnectionQueueStats interface.

Fields Summary
private static final Logger
_logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private MBeanServer
server
private ObjectName
connectionQueueName
private com.sun.enterprise.admin.monitor.stats.StringStatistic
id
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countTotalConnections
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countQueued
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
peakQueued
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxQueued
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countOverflows
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countTotalQueued
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
ticksTotalQueued
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countQueued1MinuteAverage
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countQueued5MinuteAverage
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countQueued15MinuteAverage
Constructors Summary
public PWCConnectionQueueStatsImpl(String domain)
Constructor.

param
domain Domain name



               
       
       
        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.PWCConnectionQueueStats.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=PWCConnectionQueue,*";
        try {
            connectionQueueName = 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.CountStatisticgetCountOverflows()
Gets the number of times the queue has been too full to accommodate a connection

return
Number of times the queue has been too full to accommodate a connection

        countOverflows.setCount(
            StatsUtil.getAggregateStatistic(server, connectionQueueName,
                                            "countOverflows"));
        return (CountStatistic)countOverflows.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountQueued()
Gets the number of connections currently in the queue

return
Number of connections currently in the queue

        countQueued.setCount(
            StatsUtil.getAggregateStatistic(server, connectionQueueName,
                                            "countQueued"));
        return (CountStatistic)countQueued.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountQueued15MinuteAverage()
Gets the average number of connections queued in the last 15 minutes

return
Average number of connections queued in the last 15 minutes

        countQueued15MinuteAverage.setCount(
            StatsUtil.getAverageStatistic(server, connectionQueueName,
                                          "countQueued15MinuteAverage"));
        return (CountStatistic)countQueued15MinuteAverage.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountQueued1MinuteAverage()
Gets the average number of connections queued in the last 1 minute

return
Average number of connections queued in the last 1 minute

        countQueued1MinuteAverage.setCount(
            StatsUtil.getAverageStatistic(server, connectionQueueName,
                                          "countQueued1MinuteAverage"));
        return (CountStatistic)countQueued1MinuteAverage.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountQueued5MinuteAverage()
Gets the average number of connections queued in the last 5 minutes

return
Average number of connections queued in the last 5 minutes

        countQueued5MinuteAverage.setCount(
            StatsUtil.getAverageStatistic(server, connectionQueueName,
                                          "countQueued5MinuteAverage"));
        return (CountStatistic)countQueued5MinuteAverage.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountTotalConnections()
Gets the total number of connections that have been accepted.

return
Total number of connections that have been accepted.

        countTotalConnections.setCount(
            StatsUtil.getAggregateStatistic(server, connectionQueueName,
                                            "countTotalConnections"));
        return (CountStatistic)countTotalConnections.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountTotalQueued()
Gets the total number of connections that have been queued. A given connection may be queued multiple times, so counttotalqueued may be greater than or equal to counttotalconnections.

return
Total number of connections that have been queued

        countTotalQueued.setCount(
            StatsUtil.getAggregateStatistic(server, connectionQueueName,
                                            "countTotalQueued"));
        return (CountStatistic)countTotalQueued.unmodifiableView();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetId()
Gets the ID of the connection queue

return
The ID of the connection queue

        return id;
    
public javax.management.j2ee.statistics.CountStatisticgetMaxQueued()
Gets the maximum size of the connection queue

return
Maximum size of the connection queue

        maxQueued.setCount(
            StatsUtil.getConstant(server, connectionQueueName, "maxQueued"));
        return (CountStatistic)maxQueued.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetPeakQueued()
Gets the largest number of connections that were in the queue simultaneously.

return
Largest number of connections that were in the queue simultaneously

        peakQueued.setCount(
            StatsUtil.getAggregateStatistic(server, connectionQueueName,
                                            "peakQueued"));
        return (CountStatistic)peakQueued.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();
    
public javax.management.j2ee.statistics.CountStatisticgetTicksTotalQueued()
Gets the total number of ticks that connections have spent in the queue. A tick is a system-dependent unit of time.

return
Total number of ticks that connections have spent in the queue

        ticksTotalQueued.setCount(
            StatsUtil.getAverageStatistic(server, connectionQueueName,
                                            "ticksTotalQueued"));
        return (CountStatistic)ticksTotalQueued.unmodifiableView();
    
private voidinitializeStatistics()


        long startTime = System.currentTimeMillis();
        id = new StringStatisticImpl("",
                                     "Id",
                                     "String",
                                     "ID of the connection queue",
                                     startTime,
                                     startTime);

        CountStatistic c = new CountStatisticImpl("CountTotalConnections");
        countTotalConnections = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountQueued");
        countQueued = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("PeakQueued");
        peakQueued = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("MaxQueued");
        maxQueued = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountOverflows");
        countOverflows = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountTotalQueued");
        countTotalQueued = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("TicksTotalQueued");
        ticksTotalQueued = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountQueued1MinuteAverage");
        countQueued1MinuteAverage = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountQueued5MinuteAverage");
        countQueued5MinuteAverage = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountQueued15MinuteAverage");
        countQueued15MinuteAverage = new MutableCountStatisticImpl(c);