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

WebModuleStatsImpl

public class WebModuleStatsImpl extends Object implements com.sun.enterprise.admin.monitor.stats.WebModuleStats
Class gathering web module statistics.

Fields Summary
private static final Logger
_logger
protected org.apache.catalina.Manager
sessionManager
protected com.sun.enterprise.admin.monitor.stats.GenericStatsImpl
baseStatsImpl
private com.sun.enterprise.web.monitor.PwcWebModuleStats
pwcWebStats
private long
initTime
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
jspCount
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
jspReloadCount
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
jspErrorCount
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
sessionsTotal
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
activeSessionsCurrent
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
activeSessionsHigh
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
rejectedSessionsTotal
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
expiredSessionsTotal
protected com.sun.enterprise.admin.monitor.stats.MutableCountStatistic
processingTimeMillis
Constructors Summary
public WebModuleStatsImpl()
Constructor.

    

           
      
        this(com.sun.enterprise.admin.monitor.stats.WebModuleStats.class);
    
protected WebModuleStatsImpl(Class inter)
Constructor.

param
inter Interface exposed by this instance to the monitoring framework

        baseStatsImpl = new GenericStatsImpl(inter, this);

        // initialize all the MutableStatistic Classes
        initializeStatistics();
    
Methods Summary
public javax.management.j2ee.statistics.CountStatisticgetActiveSessionsCurrent()
Gets the number of currently active sessions for the web module associated with this WebModuleStatsImpl. .

return
Number of currently active sessions

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        activeSessionsCurrent.setCount(pwcWebStats.getActiveSessionsCurrent());
        return (CountStatistic) activeSessionsCurrent.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetActiveSessionsHigh()
Gets the maximum number of concurrently active sessions for the web module associated with this WebModuleStatsImpl.

return
Maximum number of concurrently active sessions

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        activeSessionsHigh.setCount(pwcWebStats.getActiveSessionsHigh());
        return (CountStatistic) activeSessionsHigh.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetExpiredSessionsTotal()
Gets the total number of expired sessions for the web module associated with this WebModuleStatsImpl. .

return
Total number of expired sessions

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        expiredSessionsTotal.setCount(pwcWebStats.getExpiredSessionsTotal());
        return (CountStatistic) expiredSessionsTotal.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetJspCount()
Gets the number of JSPs that have been loaded in the web module associated with this WebModuleStatsImpl. .

return
Number of JSPs that have been loaded

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        jspCount.setCount(pwcWebStats.getJspCount());
        return (CountStatistic) jspCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetJspErrorCount()
Gets the number of errors that were triggered by JSP invocations. .

return
Number of errors triggered by JSP invocations

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        jspErrorCount.setCount(pwcWebStats.getJspErrorCount());
        return (CountStatistic) jspErrorCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetJspReloadCount()
Gets the number of JSPs that have been reloaded in the web module associated with this WebModuleStatsImpl. .

return
Number of JSPs that have been reloaded

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        jspReloadCount.setCount(pwcWebStats.getJspReloadCount());
        return (CountStatistic) jspReloadCount.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetRejectedSessionsTotal()
Gets the total number of rejected sessions for the web module associated with this WebModuleStatsImpl.

This is the number of sessions that were not created because the maximum allowed number of sessions were active.

return
Total number of rejected sessions

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        rejectedSessionsTotal.setCount(pwcWebStats.getRejectedSessionsTotal());
        return (CountStatistic) rejectedSessionsTotal.unmodifiableView();
    
public javax.management.j2ee.statistics.CountStatisticgetServletProcessingTimes()
Gets the cumulative processing times of all servlets in the web module associated with this WebModuleStatsImpl.

return
Cumulative processing times of all servlets in the web module associated with this WebModuleStatsImpl

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        processingTimeMillis.setCount(
            pwcWebStats.getServletProcessingTimesMillis());
        return (CountStatistic) processingTimeMillis.unmodifiableView();
    
public com.sun.enterprise.admin.monitor.stats.StringStatisticgetSessions()
Returns comma-separated list of all sessions currently active in the web module associated with this WebModuleStatsImpl.

return
Comma-separated list of all sessions currently active in the web module associated with this WebModuleStatsImpl

    
        StringBuffer sb = null;

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }

        String sessionIds = pwcWebStats.getSessionIds();
        if (sessionIds != null) {
            sb = new StringBuffer();
            StringTokenizer tokenizer = new StringTokenizer(sessionIds, " ");
            boolean first = true;
            while (tokenizer.hasMoreTokens()) {
                if (!first) {
                    sb.append(", ");
                } else {
                    first = false;
                }
                String sessionId = tokenizer.nextToken();
                sb.append(sessionId);
                HashMap map = pwcWebStats.getSession(sessionId);
                if (map != null) { 
                    sb.append(":");
                    sb.append(map);
                }
            }
        }

        return new StringStatisticImpl(
                    sb != null ? sb.toString(): null,
                    "Sessions",
                    "String",
                    "List of currently active sessions",
                    initTime,
                    System.currentTimeMillis()); 
    
public javax.management.j2ee.statistics.CountStatisticgetSessionsTotal()
Gets the total number of sessions that have been created for the web module associated with this WebModuleStatsImpl. .

return
Total number of sessions created

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        sessionsTotal.setCount(pwcWebStats.getSessionsTotal());
        return (CountStatistic) sessionsTotal.unmodifiableView();
    
public javax.management.j2ee.statistics.StatisticgetStatistic(java.lang.String name)
Queries for a statistic by name.

param
name The name of the statistic to query for
return
The statistic corresponding to the given name

        return baseStatsImpl.getStatistic(name);
    
public java.lang.String[]getStatisticNames()
Returns the names of all statistics that may be retrieved from this WebModuleStatsImpl instance.

return
Array of names of all statistics exposed by this WebModuleStatsImpl instance

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

return
Array of all statistics exposed by this WebModuleStatsImpl instance

        return baseStatsImpl.getStatistics();
    
private voidinitializeStatistics()

        
        jspCount = new MutableCountStatisticImpl(
                        new CountStatisticImpl("JspCount"));
        jspReloadCount = new MutableCountStatisticImpl(
                        new CountStatisticImpl("JspReloadCount"));
        jspErrorCount = new MutableCountStatisticImpl(
                        new CountStatisticImpl("JspErrorCount"));
        sessionsTotal = new MutableCountStatisticImpl(
                        new CountStatisticImpl("SessionsTotal"));
        activeSessionsCurrent = new MutableCountStatisticImpl(
                        new CountStatisticImpl("ActiveSessionsCurrent"));
        activeSessionsHigh = new MutableCountStatisticImpl(
                        new CountStatisticImpl("ActiveSessionsHigh"));
        rejectedSessionsTotal = new MutableCountStatisticImpl(
                        new CountStatisticImpl("RejectedSessionsTotal"));
        expiredSessionsTotal = new MutableCountStatisticImpl(
                        new CountStatisticImpl("ExpiredSessionsTotal"));
        processingTimeMillis = new MutableCountStatisticImpl(
                    new CountStatisticImpl("ServletProcessingTimes"));
        initTime = System.currentTimeMillis ();
    
public voidreset()
Resets this WebModuleStats.


        // Reset session stats
        if (sessionManager instanceof MonitorStatsCapable) {
            ((MonitorStatsCapable)sessionManager).resetMonitorStats();
        }

        if (pwcWebStats != null) {
            pwcWebStats.reset();
        }
    
public voidsetPwcWebModuleStats(com.sun.enterprise.web.monitor.PwcWebModuleStats pwcWebStats)
Sets the PwcWebModuleStats instance to which this WebModuleStatsImpl is going to delegate.

param
pwcWebStats PwcWebModuleStats instance to which to delegate

        if (pwcWebStats == null) {
            throw new IllegalArgumentException("Null PwcWebModuleStats");
        }
        this.pwcWebStats = pwcWebStats;
    
public voidsetSessionManager(org.apache.catalina.Manager manager)
Sets the session manager that this WebModuleStatsImpl is going to query for session-related stats.

param
manager Session manager

        if (manager == null) {
            throw new IllegalArgumentException("Null session manager");
        }
        this.sessionManager = manager;