Author: markt
Date: Thu May  5 14:29:04 2011
New Revision: 1099820

URL: http://svn.apache.org/viewvc?rev=1099820&view=rev
Log:
Revert r830965 and restore the automatic disabling of HTTP keep-alive once 75% 
of the threads are in use.

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=1099820&r1=1099819&r2=1099820&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Thu May  5 
14:29:04 2011
@@ -171,6 +171,20 @@ public class Http11Processor extends Abs
         
         int soTimeout = endpoint.getSoTimeout();
 
+        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;      
+        }
+
         try {
             socket.getSocket().setSoTimeout(soTimeout);
         } catch (Throwable t) {



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

Reply via email to