tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r830589 - /tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
Date Wed, 28 Oct 2009 15:30:49 GMT
Author: markt
Date: Wed Oct 28 15:30:49 2009
New Revision: 830589

URL: http://svn.apache.org/viewvc?rev=830589&view=rev
Log:
Ensure thread ratio calc is valid

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=830589&r1=830588&r2=830589&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Wed Oct 28 15:30:49 2009
@@ -171,8 +171,16 @@
         
         int soTimeout = endpoint.getSoTimeout();
 
-        int threadRatio = (endpoint.getCurrentThreadsBusy() * 100)
-                / endpoint.getMaxThreads();
+        int threadRatio = -1;
+        // These may return zero or negative values
+        // Only calculate a thread ratio when both are >0 to ensure we get a
+        // sensible result
+        if (endpoint.getCurrentThreadsBusy() >0 &&
+                endpoint.getMaxThreads() >0) {
+            threadRatio = (endpoint.getCurrentThreadsBusy() * 100)
+                    / endpoint.getMaxThreads();
+        }
+        // Disable keep-alive if we are running low on threads
         if (threadRatio > 75) {
             keepAliveLeft = 1;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message