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

ServletStatsImpl

public class ServletStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.ServletStats

Fields Summary
private static final Logger
_logger
private com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
maxTimeMillis
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
processingTimeMillis
private javax.management.j2ee.statistics.TimeStatistic
serviceTimeMillis
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
requestCount
private com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
errorCount
private com.sun.enterprise.web.monitor.PwcServletStats
pwcServletStats
Constructors Summary
public ServletStatsImpl(com.sun.enterprise.web.monitor.PwcServletStats pwcServletStats)
Constructor.

param
pwcServletStats PwcServletStats instance to which to delegate


    
                  
       

        this.pwcServletStats = pwcServletStats;

        baseStatsImpl = new GenericStatsImpl(
            com.sun.enterprise.admin.monitor.stats.ServletStats.class, this);

        // initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetErrorCount()
The errorCount represents the number of cases where the response code was >= 400

return
CountStatistic

        errorCount.setCount(pwcServletStats.getErrorCount());
        return (CountStatistic)errorCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetMaxTime()
The maximum processing time of a servlet request

return
CountStatistic

        maxTimeMillis.setCount(pwcServletStats.getMaxTimeMillis());
        return (CountStatistic)maxTimeMillis.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetProcessingTime()
Gets the total execution time of the servlet's service method.

return
Total execution time of the servlet's service method

        processingTimeMillis.setCount(pwcServletStats.getProcessingTimeMillis());
        return (CountStatistic)processingTimeMillis.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetRequestCount()
Number of requests processed by this servlet.

return
CountStatistic

        requestCount.setCount(pwcServletStats.getRequestCount());
        return (CountStatistic)requestCount.unmodifiableView();
    
public javax.management.j2ee.statistics.TimeStatisticgetServiceTime()
Gets the execution time of the servlet's service method as a TimeStatistic.

return
Execution time of the servlet's service method

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

        
       // Initialize the MutableCountStatistic for ErrorCount
        CountStatistic c = new CountStatisticImpl("ErrorCount");
        errorCount = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for MaxTime
        c = new CountStatisticImpl("MaxTime", "milliseconds");
        maxTimeMillis = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for ProcessingTime
        c = new CountStatisticImpl("ProcessingTime", "milliseconds");
        processingTimeMillis = new MutableCountStatisticImpl(c);
        
        // Initialize the MutableCountStatistic for RequestCount
        c = new CountStatisticImpl("RequestCount");
        requestCount = new MutableCountStatisticImpl(c);

        // Initialize the MutableTimeStatistic for ServiceTime
        serviceTimeMillis = new ServletTimeStatisticImpl("ServiceTime",
                                                         "milliseconds",
                                                         pwcServletStats);