fix request processing stats
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Oct 2007 14:20:13 +0000 (14:20 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Oct 2007 14:20:13 +0000 (14:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@581920 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/RequestInfo.java

index 6a84d77..ce45d58 100644 (file)
@@ -112,7 +112,8 @@ public class RequestInfo  {
     }
 
     public long getRequestProcessingTime() {
-        return (System.currentTimeMillis() - req.getStartTime());
+        if ( getStage() == org.apache.coyote.Constants.STAGE_ENDED ) return 0;
+        else return (System.currentTimeMillis() - req.getStartTime());
     }
 
     // -------------------- Statistical data  --------------------
@@ -130,6 +131,9 @@ public class RequestInfo  {
     private int requestCount;
     // number of response codes >= 400
     private int errorCount;
+    
+    //the time of the last request
+    private long lastRequestProcessingTime = 0;
 
 
     /** Called by the processor before recycling the request. It'll collect
@@ -145,6 +149,7 @@ public class RequestInfo  {
         long t0=req.getStartTime();
         long t1=System.currentTimeMillis();
         long time=t1-t0;
+        this.lastRequestProcessingTime = time;
         processingTime+=time;
         if( maxTime < time ) {
             maxTime=time;
@@ -224,6 +229,10 @@ public class RequestInfo  {
         return rpName;
     }
 
+    public long getLastRequestProcessingTime() {
+        return lastRequestProcessingTime;
+    }
+
     public void setWorkerThreadName(String workerThreadName) {
         this.workerThreadName = workerThreadName;
     }
@@ -231,4 +240,8 @@ public class RequestInfo  {
     public void setRpName(ObjectName rpName) {
         this.rpName = rpName;
     }
+
+    public void setLastRequestProcessingTime(long lastRequestProcessingTime) {
+        this.lastRequestProcessingTime = lastRequestProcessingTime;
+    }
 }