Currently, the RequestInfo.getRequestProcessingTime is not taking into account if the request is active or not, hence returning a larger and larger value if a new request is not received.
The patch addresses the following

1. getRequestProcessingTime returns 0 if no request is active
2. getLastRequestProcessingTime will return the time for the last request

Does anyone think the values that are returned should be different?
thoughts?
Filip
Index: org/apache/coyote/RequestInfo.java
===================================================================
--- org/apache/coyote/RequestInfo.java  (revision 578847)
+++ org/apache/coyote/RequestInfo.java  (working copy)
@@ -112,7 +112,8 @@
     }
 
     public long getRequestProcessingTime() {
-        return (System.currentTimeMillis() - req.getStartTime());
+        if ( req.getStartTime() == 0 ) 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 lastRequestProcssingTime = 0;
 
 
     /** Called by the processor before recycling the request. It'll collect
@@ -145,11 +149,13 @@
         long t0=req.getStartTime();
         long t1=System.currentTimeMillis();
         long time=t1-t0;
+        this.lastRequestProcssingTime = time;
         processingTime+=time;
         if( maxTime < time ) {
             maxTime=time;
             maxRequestUri=req.requestURI().toString();
         }
+        req.setStartTime(0);
     }
 
     public int getStage() {
@@ -224,6 +230,10 @@
         return rpName;
     }
 
+    public long getLastRequestProcssingTime() {
+        return lastRequestProcssingTime;
+    }
+
     public void setWorkerThreadName(String workerThreadName) {
         this.workerThreadName = workerThreadName;
     }
@@ -231,4 +241,8 @@
     public void setRpName(ObjectName rpName) {
         this.rpName = rpName;
     }
+
+    public void setLastRequestProcssingTime(long lastRequestProcssingTime) {
+        this.lastRequestProcssingTime = lastRequestProcssingTime;
+    }
 }
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to