here is the modified patch

Filip

Bill Barker wrote:
I would think that using the stage would be more reliable than hacking the
startTime, but otherwise, I have no strong opinion either way.
-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 11:49 AM
To: Tomcat Developers List
Subject: 6.0.x request processing patch

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




This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


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




Index: java/org/apache/coyote/RequestInfo.java
===================================================================
--- java/org/apache/coyote/RequestInfo.java     (revision 578847)
+++ java/org/apache/coyote/RequestInfo.java     (working copy)
@@ -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 lastRequestProcssingTime = 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.lastRequestProcssingTime = time;
         processingTime+=time;
         if( maxTime < time ) {
             maxTime=time;
@@ -224,6 +229,10 @@
         return rpName;
     }
 
+    public long getLastRequestProcssingTime() {
+        return lastRequestProcssingTime;
+    }
+
     public void setWorkerThreadName(String workerThreadName) {
         this.workerThreadName = workerThreadName;
     }
@@ -231,4 +240,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