FileDocCategorySizeDatePackage
RequestGroupInfo.javaAPI DocApache Tomcat 6.0.145785Fri Jul 20 04:20:36 BST 2007org.apache.coyote

RequestGroupInfo

public class RequestGroupInfo extends Object
This can be moved to top level ( eventually with a better name ). It is currently used only as a JMX artifact, to agregate the data collected from each RequestProcessor thread.

Fields Summary
ArrayList
processors
private long
deadMaxTime
private long
deadProcessingTime
private int
deadRequestCount
private int
deadErrorCount
private long
deadBytesReceived
private long
deadBytesSent
Constructors Summary
Methods Summary
public synchronized voidaddRequestProcessor(RequestInfo rp)


           
        processors.add( rp );
    
public synchronized longgetBytesReceived()

        long bytes=deadBytesReceived;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            bytes += rp.getBytesReceived();
        }
        return bytes;
    
public synchronized longgetBytesSent()

        long bytes=deadBytesSent;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            bytes += rp.getBytesSent();
        }
        return bytes;
    
public synchronized intgetErrorCount()

        int requestCount=deadErrorCount;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            requestCount += rp.getErrorCount();
        }
        return requestCount;
    
public synchronized longgetMaxTime()

        long maxTime=deadMaxTime;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            if( maxTime < rp.getMaxTime() ) maxTime=rp.getMaxTime();
        }
        return maxTime;
    
public synchronized longgetProcessingTime()

        long time=deadProcessingTime;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            time += rp.getProcessingTime();
        }
        return time;
    
public synchronized intgetRequestCount()

        int requestCount=deadRequestCount;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            requestCount += rp.getRequestCount();
        }
        return requestCount;
    
public synchronized voidremoveRequestProcessor(RequestInfo rp)

        if( rp != null ) {
            if( deadMaxTime < rp.getMaxTime() )
                deadMaxTime = rp.getMaxTime();
            deadProcessingTime += rp.getProcessingTime();
            deadRequestCount += rp.getRequestCount();
            deadErrorCount += rp.getErrorCount();
            deadBytesReceived += rp.getBytesReceived();
            deadBytesSent += rp.getBytesSent();

            processors.remove( rp );
        }
    
public voidresetCounters()

        this.setBytesReceived(0);
        this.setBytesSent(0);
        this.setRequestCount(0);
        this.setProcessingTime(0);
        this.setMaxTime(0);
        this.setErrorCount(0);
    
public synchronized voidsetBytesReceived(long bytesReceived)

        deadBytesReceived = bytesReceived;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setBytesReceived( bytesReceived );
        }
    
public synchronized voidsetBytesSent(long bytesSent)

        deadBytesSent = bytesSent;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setBytesSent( bytesSent );
        }
    
public synchronized voidsetErrorCount(int errorCount)

        deadErrorCount = errorCount;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setErrorCount( errorCount);
        }
    
public synchronized voidsetMaxTime(long maxTime)

        deadMaxTime = maxTime;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setMaxTime(maxTime);
        }
    
public synchronized voidsetProcessingTime(long totalTime)

        deadProcessingTime = totalTime;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setProcessingTime( totalTime );
        }
    
public synchronized voidsetRequestCount(int requestCount)

        deadRequestCount = requestCount;
        for( int i=0; i<processors.size(); i++ ) {
            RequestInfo rp=(RequestInfo)processors.get( i );
            rp.setRequestCount( requestCount );
        }