Author: fhanik
Date: Thu Oct  4 07:20:13 2007
New Revision: 581920

URL: http://svn.apache.org/viewvc?rev=581920&view=rev
Log:
fix request processing stats

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/RequestInfo.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/RequestInfo.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/RequestInfo.java?rev=581920&r1=581919&r2=581920&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/RequestInfo.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/RequestInfo.java Thu Oct  4 
07:20:13 2007
@@ -112,7 +112,8 @@
     }
 
     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 @@
     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 @@
         long t0=req.getStartTime();
         long t1=System.currentTimeMillis();
         long time=t1-t0;
+        this.lastRequestProcessingTime = time;
         processingTime+=time;
         if( maxTime < time ) {
             maxTime=time;
@@ -224,11 +229,19 @@
         return rpName;
     }
 
+    public long getLastRequestProcessingTime() {
+        return lastRequestProcessingTime;
+    }
+
     public void setWorkerThreadName(String workerThreadName) {
         this.workerThreadName = workerThreadName;
     }
 
     public void setRpName(ObjectName rpName) {
         this.rpName = rpName;
+    }
+
+    public void setLastRequestProcessingTime(long lastRequestProcessingTime) {
+        this.lastRequestProcessingTime = lastRequestProcessingTime;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to