FileDocCategorySizeDatePackage
WebServiceEndpointStatsProviderImpl.javaAPI DocGlassfish v2 API7870Fri May 04 22:24:46 BST 2007com.sun.enterprise.admin.wsmgmt.stats.impl

WebServiceEndpointStatsProviderImpl

public class WebServiceEndpointStatsProviderImpl extends Object implements com.sun.enterprise.admin.wsmgmt.stats.spi.WebServiceEndpointStatsProvider
A Class for providing stats for Web Service Endpoint.
author
Satish Viswanatham

Fields Summary
String
faultActor
String
faultString
String
faultCode
String
clientHost
String
clientUser
int
responseSize
int
requestSize
int
totalFaults
int
totalSuccess
int
totalAuthFailures
int
totalAuthSuccess
long
responseTime
long
totalResponseTime
long
avgResponseTime
long
minResponseTime
long
maxResponseTime
double
throughput
long
enterTime
long
resetTime
int
reqSize
String
cHost
String
cUser
Constructors Summary
public WebServiceEndpointStatsProviderImpl()

        faultActor = faultString = faultCode = clientHost = clientUser = null;
        responseSize = requestSize = totalFaults =
        totalSuccess = totalAuthFailures =  totalAuthSuccess = 0;
        responseTime = avgResponseTime =
                totalResponseTime = maxResponseTime = (long)0;
        resetTime = System.currentTimeMillis();
        minResponseTime = -1;
        throughput = 0.0;

    
Methods Summary
voidcalculateResponseTimes(long curRespTime)

        if ( curRespTime > maxResponseTime) {
            maxResponseTime = curRespTime;
        }

        if (minResponseTime < 0 ) {
            minResponseTime = curRespTime;
        } else if ( curRespTime < minResponseTime) {
            minResponseTime = curRespTime;
        }
        totalResponseTime += curRespTime;
    
public voidcleanup()

        enterTime = 0;
        cHost = cUser = null;
    
public longgetAverageResponseTime()

        int totalInv =  totalSuccess + totalFaults;
        if  (totalInv == 0 ) {
            return (long)0;
        } else {
            return totalResponseTime/ (totalInv);
        }
    
public java.lang.StringgetClientHost()

        return clientHost;
    
public java.lang.StringgetClientUser()

        return clientUser;
    
public java.lang.StringgetFaultActor()

        return faultActor;
    
public java.lang.StringgetFaultCode()

        return faultCode;
    
public java.lang.StringgetFaultString()

        return faultString;
    
public longgetLastResetTime()

        return resetTime;
    
public longgetMaxResponseTime()

        return maxResponseTime;
    
public longgetMinResponseTime()

        if (minResponseTime < 0 ) {
            return 0;
        } else {
            return minResponseTime;
        }
    
public intgetRequestSize()

        return requestSize;
    
public intgetResponseSize()

        return responseSize;
    
public longgetResponseTime()

        return responseTime;
    
public doublegetThroughput()

        long avgRespTime = getAverageResponseTime();
        double dValue = avgRespTime;
        if ( avgRespTime == 0 ) {
            return 0;
        } else {
            return 1000/dValue;
        }
    
public intgetTotalAuthFailures()

        return totalAuthFailures;
    
public intgetTotalAuthSuccesses()

        return totalAuthSuccess;
    
public intgetTotalFailures()

        return totalFaults;
    
public intgetTotalSuccesses()

        return totalSuccess;
    
public voidprecheck()

        if ( enterTime == 0 ) {
            throw new RuntimeException(
            "Request method should also update the request stats");
        }

        // XXX store this stat into message store if history size is > 0

    
public voidreset()

        faultActor = faultString = faultCode = clientHost = clientUser = null;
        responseSize = requestSize = totalFaults =
        totalSuccess = totalAuthFailures =  totalAuthSuccess = 0;
        responseTime = totalResponseTime = maxResponseTime =
        avgResponseTime = (long) 0;
        resetTime = System.currentTimeMillis();
        throughput = 0.0;
        minResponseTime = -1;
    
public voidsetAuthFailure(long t)


        // precheck(); -- precheck may not be called for auth failures

        clientHost = cHost;
        clientUser = cUser;
        requestSize = reqSize;
        totalFaults++;
        totalAuthFailures++;
    
        // since this is success reset the fault related values
        faultCode = faultString = faultActor = null;

        cleanup();

    
public voidsetFault(int resSize, long exitTime, long rTime, java.lang.String fCode, java.lang.String fString, java.lang.String fActor)

        precheck();

        responseTime = rTime;
        calculateResponseTimes (responseTime);
        clientHost = cHost;
        clientUser = cUser;
        requestSize = reqSize;
        responseSize = resSize;
        totalFaults++;
        totalAuthSuccess++;
    
        // since this is success reset the fault related values
        faultCode = fCode;
        faultString = fString;
        faultActor = fActor;

        cleanup();

    
public voidsetRequestTimeStamp(long t, java.lang.String host, java.lang.String user, int rSize)


        enterTime = t;
        reqSize = rSize;
        cHost = host;
        cUser = user;
    
public voidsetSuccess(int resSize, long exitTime, long respTime)

        
        precheck();

        responseTime =  respTime;
        calculateResponseTimes (responseTime);
        clientHost = cHost;
        clientUser = cUser;
        requestSize = reqSize;
        responseSize = resSize;
        totalSuccess++;
        totalAuthSuccess++;
    
        // since this is success reset the fault related values
        faultCode = faultString = faultActor = null;

        cleanup();