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

PWCRequestStatsImpl

public class PWCRequestStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.PWCRequestStats
Implementation of the PWCRequestStats interface, which exposes statistics about all HTTP listeners associated with a given virtual server.

Fields Summary
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private long
startTime
private LinkedList
httpListenerStats
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countRequests
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countBytesReceived
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countBytesTransmitted
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
rateBytesTransmitted
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxByteTransmissionRate
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countOpenConnections
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxOpenConnections
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count2xx
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count3xx
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count4xx
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count5xx
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
countOther
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count200
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count302
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count304
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count400
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count401
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count403
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count404
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
count503
Constructors Summary
public PWCRequestStatsImpl(String domain)
Constructor.

param
domain Domain name


        httpListenerStats = new LinkedList();
       
        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.PWCRequestStats.class,
            this);
        
        // Initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
public voidaddHttpListenerStats(HTTPListenerStatsImpl stats)
Adds the given HTTPListenerStatsImpl to the list of HTTPListenerStatsImpl from which this PWCRequestStatsImpl gathers its stats.

param
stats The HTTPListenerStatsImpl instance to add to the list

        httpListenerStats.add(stats);
    
public javax.management.j2ee.statistics.CountStatisticgetCount200()
Gets the number of responses with a 200 response code.

return
Number of responses with a 200 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount200Long();
        }

        count200.setCount(count);
        return (CountStatistic)count200.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount2xx()
Gets the number of 200-level responses sent.

return
Number of 200-level responses sent


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount2xxLong();
        }

        count2xx.setCount(count);
        return (CountStatistic)count2xx.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount302()
Gets the number of responses with a 302 response code.

return
Number of responses with a 302 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount302Long();
        }

        count302.setCount(count);
        return (CountStatistic)count302.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount304()
Gets the number of responses with a 304 response code.

return
Number of responses with a 304 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount304Long();
        }

        count304.setCount(count);
        return (CountStatistic)count304.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount3xx()
Gets the number of 300-level responses sent.

return
Number of 300-level responses sent


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount3xxLong();
        }

        count3xx.setCount(count);
        return (CountStatistic)count3xx.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount400()
Gets the number of responses with a 400 response code.

return
Number of responses with a 400 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount400Long();
        }

        count400.setCount(count);
        return (CountStatistic)count400.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount401()
Gets the number of responses with a 401 response code.

return
Number of responses with a 401 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount401Long();
        }

        count401.setCount(count);
        return (CountStatistic)count401.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount403()
Gets the number of responses with a 403 response code.

return
Number of responses with a 403 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount403Long();
        }

        count403.setCount(count);
        return (CountStatistic)count403.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount404()
Gets the number of responses with a 404 response code.

return
Number of responses with a 404 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount404Long();
        }

        count404.setCount(count);
        return (CountStatistic)count404.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount4xx()
Gets the number of 400-level responses sent.

return
Number of 400-level responses sent


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount4xxLong();
        }

        count4xx.setCount(count);
        return (CountStatistic)count4xx.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount503()
Gets the number of responses with a 503 response code.

return
Number of responses with a 503 response code


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount503Long();
        }

        count503.setCount(count);
        return (CountStatistic)count503.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCount5xx()
Gets the number of 500-level responses sent.

return
Number of 500-level responses sent


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCount5xxLong();
        }

        count5xx.setCount(count);
        return (CountStatistic)count5xx.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountBytesReceived()
Gets the number of bytes received.

return
Number of bytes received, or 0 if this information is not available


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getBytesReceivedLong();
        }

        countBytesReceived.setCount(count);
        return (CountStatistic)countBytesReceived.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountBytesTransmitted()
Gets the number of bytes transmitted.

return
Number of bytes transmitted, or 0 if this information is not available


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getBytesSentLong();
        }

        countBytesTransmitted.setCount(count);
        return (CountStatistic)countBytesTransmitted.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountOpenConnections()
Gets the number of open connections.

return
Number of open connections, or 0 if this information is not available


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCountOpenConnectionsLong();
        }

        countOpenConnections.setCount(count);
        return (CountStatistic)countOpenConnections.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountOther()
Gets the number of responses sent that were not 200, 300, 400, or 500 level.

return
Number of responses sent that were not 200, 300, 400, or 500 level


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getCountOtherLong();
        }

        countOther.setCount(count);
        return (CountStatistic)countOther.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetCountRequests()
Gets the number of requests serviced.

return
Number of requests serviced


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getRequestCountLong();
        }

        countRequests.setCount(count);
        return (CountStatistic)countRequests.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxByteTransmissionRate()
Gets the maximum rate at which data was transmitted over some server-defined interval.

return
Maximum rate at which data was transmitted over some server-defined interval, or 0 if this information is not available.

        maxByteTransmissionRate.setCount(0);
        return (CountStatistic)maxByteTransmissionRate.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxOpenConnections()
Gets the maximum number of open connections.

return
Maximum number of open connections, or 0 if this information is not available


        long count = 0;
        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            count += httpListenerStats.get(i).getMaxOpenConnectionsLong();
        }

        maxOpenConnections.setCount(count);
        return (CountStatistic)maxOpenConnections.unmodifiableView();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetMethod()
Gets the method of the last request serviced.

return
Method of the last request serviced


        String lastMethod = "unknown";
        long lastRequestTime = 0;

        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            HTTPListenerStatsImpl listener = httpListenerStats.get(i);
            if (listener.getLastRequestCompletionTime() > lastRequestTime) {
                lastRequestTime = listener.getLastRequestCompletionTime();
                lastMethod = listener.getLastRequestMethod();
            }
        }

        return new StringStatisticImpl(
                                lastMethod,
                                "method",
                                "String",
                                "Method of the last request serviced",
                                startTime,
                                System.currentTimeMillis());
    
public javax.management.j2ee.statistics.CountStatisticgetRateBytesTransmitted()
Gets the rate (in bytes per second) at which data was transmitted over some server-defined interval.

return
Rate (in bytes per second) at which data was transmitted over some server-defined interval, or 0 if this information is not available

        rateBytesTransmitted.setCount(0);
        return (CountStatistic)rateBytesTransmitted.unmodifiableView();
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String name)
Gets the statistic with the given name.

param
name Statistic name
return
Statistic with the given name

        return baseStatsImpl.getStatistic(name);
    
public java.lang.String[]getStatisticNames()
Gets the names of all statistics exposed by this PWCRequestStatsImpl

return
Array of the names of all statistics exposed by this PWCRequestStatsImpl

        return baseStatsImpl.getStatisticNames();
    
public javax.management.j2ee.statistics.Statistic[]getStatistics()
Gets all statistics exposed by this PWCRequestStatsImpl

return
Array of all statistics exposed by this PWCRequestStatsImpl

        return baseStatsImpl.getStatistics();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetUri()
Gets the URI of the last request serviced.

return
URI of the last request serviced


        String lastURI = "unknown";
        long lastRequestTime = 0;

        int size = httpListenerStats.size();
        for (int i=0; i<size; i++) {
            HTTPListenerStatsImpl listener = httpListenerStats.get(i);
            if (listener.getLastRequestCompletionTime() > lastRequestTime) {
                lastRequestTime = listener.getLastRequestCompletionTime();
                lastURI = listener.getLastRequestURI();
            }
        }

        return new StringStatisticImpl(
                                lastURI,
                                "uri",
                                "String",
                                "URI of the last request serviced",
                                startTime,
                                System.currentTimeMillis());
    
private voidinitializeStatistics()


        startTime = System.currentTimeMillis();
        
        CountStatistic c = new CountStatisticImpl("CountRequests");
        countRequests = new MutableCountStatisticImpl(c);
        
        c = new CountStatisticImpl("CountBytesReceived");
        countBytesReceived = new MutableCountStatisticImpl(c);
        
        c = new CountStatisticImpl("CountBytesTransmitted");
        countBytesTransmitted = new MutableCountStatisticImpl(c);
        
        c = new CountStatisticImpl("RateBytesTransmitted");
        rateBytesTransmitted = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("MaxByteTransmissionRate");
        maxByteTransmissionRate = new MutableCountStatisticImpl(c);
        
        c = new CountStatisticImpl("CountOpenConnections");
        countOpenConnections = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("MaxOpenConnections");
        maxOpenConnections = new MutableCountStatisticImpl(c);
        
        c = new CountStatisticImpl("Count2xx");
        count2xx = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count3xx");
        count3xx = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count4xx");
        count4xx = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count5xx");
        count5xx = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("CountOther");
        countOther = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count200");
        count200 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count302");
        count302 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count304");
        count304 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count400");
        count400 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count401");
        count401 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count403");
        count403 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count404");
        count404 = new MutableCountStatisticImpl(c);

        c = new CountStatisticImpl("Count503");
        count503 = new MutableCountStatisticImpl(c);