- The addition of keepAliveTimeout is useless for the regular connector, as it alread...
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 29 Sep 2006 09:42:56 +0000 (09:42 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 29 Sep 2006 09:42:56 +0000 (09:42 +0000)
  option.
- Make it default to soTimeout in the other cases.
- Sendfile should not use keepAliveTimeout, but soTimeout.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@451202 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/Constants.java
java/org/apache/coyote/ajp/AjpAprProtocol.java
java/org/apache/coyote/ajp/Constants.java
java/org/apache/coyote/http11/Constants.java
java/org/apache/coyote/http11/Http11AprProcessor.java
java/org/apache/coyote/http11/Http11AprProtocol.java
java/org/apache/coyote/http11/Http11Processor.java
java/org/apache/coyote/http11/Http11Protocol.java
java/org/apache/tomcat/util/net/AprEndpoint.java

index 24ddffe..7f49bb9 100644 (file)
@@ -34,7 +34,6 @@ public final class Constants {
     public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
     public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
     public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
-    public static final int DEFAULT_KEEPALIVE_TIMEOUT = 15000;
 
     public static final int PROCESSOR_IDLE = 0;
     public static final int PROCESSOR_ACTIVE = 1;
index 73206cd..6a10a1d 100644 (file)
@@ -68,6 +68,7 @@ public class AjpAprProtocol
         cHandler = new AjpConnectionHandler(this);
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
+        setKeepAliveTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
         //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
index 368d563..077ee37 100644 (file)
@@ -38,7 +38,6 @@ public final class Constants {
     public static final int DEFAULT_CONNECTION_LINGER = -1;
     public static final int DEFAULT_CONNECTION_TIMEOUT = -1;
     public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
-    public static final int DEFAULT_KEEPALIVE_TIMEOUT = 15000;    
     public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
     public static final boolean DEFAULT_TCP_NO_DELAY = true;
 
index 5f3a2fb..46dde83 100644 (file)
@@ -39,7 +39,6 @@ public final class Constants {
     public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
     public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
     public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
-    public static final int DEFAULT_KEEPALIVE_TIMEOUT = 15000;
     public static final boolean DEFAULT_TCP_NO_DELAY = true;
     
     
index 9744899..e0c8588 100644 (file)
@@ -209,12 +209,6 @@ public class Http11AprProcessor implements ActionHook {
     protected int maxKeepAliveRequests = -1;
 
     /**
-     * The number of seconds Tomcat will wait for a subsequent request
-     * before closing the connection.
-     */
-    protected int keepAliveTimeout = 15000;
-
-    /**
      * SSL enabled ?
      */
     protected boolean ssl = false;
@@ -649,21 +643,6 @@ public class Http11AprProcessor implements ActionHook {
     }
 
     /**
-     * Set the Keep-Alive timeout.
-     */
-    public void setKeepAliveTimeout(int timeout) {
-        keepAliveTimeout = timeout;
-    }
-
-
-    /**
-     * Return the number Keep-Alive timeout.
-     */
-    public int getKeepAliveTimeout() {
-        return keepAliveTimeout;
-    }
-
-    /**
      * Set the maximum size of a POST which will be buffered in SSL mode.
      */
     public void setMaxSavePostSize(int msps) {
index f58275a..c8706c5 100644 (file)
@@ -54,6 +54,7 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration
         cHandler = new Http11ConnectionHandler( this );
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
+        setKeepAliveTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
         //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
index b6f3a75..a5fc68a 100644 (file)
@@ -185,12 +185,6 @@ public class Http11Processor implements ActionHook {
      */
     protected int maxKeepAliveRequests = -1;
 
-    /**
-     * The number of seconds Tomcat will wait for a subsequent request
-     * before closing the connection.
-     */
-    protected int keepAliveTimeout = 15000;
-
 
     /**
      * SSL information.
@@ -627,22 +621,6 @@ public class Http11Processor implements ActionHook {
     }
 
     /**
-     * Set the Keep-Alive timeout.
-     */
-    public void setKeepAliveTimeout(int timeout) {
-        keepAliveTimeout = timeout;
-    }
-
-
-    /**
-     * Return the number Keep-Alive timeout.
-     */
-    public int getKeepAliveTimeout() {
-        return keepAliveTimeout;
-    }
-
-
-    /**
      * Set the maximum size of a POST which will be buffered in SSL mode.
      */
     public void setMaxSavePostSize(int msps) {
@@ -799,13 +777,8 @@ public class Http11Processor implements ActionHook {
 
             // Parsing the request header
             try {
-                if (!disableUploadTimeout && keptAlive) {
-                    if (keepAliveTimeout > 0) {
-                        socket.setSoTimeout(keepAliveTimeout);
-                    }
-                    else if (soTimeout > 0) {
-                        socket.setSoTimeout(soTimeout);                        
-                    }
+                if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
+                    socket.setSoTimeout(soTimeout);
                 }
                 inputBuffer.parseRequestLine();
                 request.setStartTime(System.currentTimeMillis());
index 8a37d6a..9483c81 100644 (file)
@@ -70,7 +70,6 @@ public class Http11Protocol
     public Http11Protocol() {
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
-        setKeepAliveTimeout(Constants.DEFAULT_KEEPALIVE_TIMEOUT);
         //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
@@ -284,17 +283,6 @@ public class Http11Protocol
 
     // HTTP
     /**
-     * The number of seconds Tomcat will wait for a subsequent request
-     * before closing the connection. The default is the same as for
-     * Apache HTTP Server (15 000 milliseconds).
-     */
-    protected int keepAliveTimeout = 15000;
-    public int getKeepAliveTimeout() { return keepAliveTimeout; }
-    public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout; }
-
-
-    // HTTP
-    /**
      * This timeout represents the socket timeout which will be used while
      * the adapter execution is in progress, unless disableUploadTimeout
      * is set to true. The default is the same as for Apache HTTP Server
@@ -591,7 +579,6 @@ public class Http11Protocol
                         new Http11Processor(protocol.maxHttpHeaderSize, protocol.endpoint);
                     processor.setAdapter(protocol.adapter);
                     processor.setMaxKeepAliveRequests(protocol.maxKeepAliveRequests);
-                    processor.setKeepAliveTimeout(protocol.keepAliveTimeout);
                     processor.setTimeout(protocol.timeout);
                     processor.setDisableUploadTimeout(protocol.disableUploadTimeout);
                     processor.setCompression(protocol.compression);
index 2ec532f..a9f7f5c 100644 (file)
@@ -258,7 +258,7 @@ public class AprEndpoint {
     /**
      * Keep-Alive timeout.
      */
-    protected int keepAliveTimeout = 15000;
+    protected int keepAliveTimeout = -1;
     public int getKeepAliveTimeout() { return keepAliveTimeout; }
     public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout; }
 
@@ -1573,14 +1573,14 @@ public class AprEndpoint {
         protected void init() {
             pool = Pool.create(serverSockPool);
             int size = sendfileSize / sendfileThreadCount;
-            sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
+            sendfilePollset = allocatePoller(size, pool, soTimeout);
             if (sendfilePollset == 0 && size > 1024) {
                 size = 1024;
-                sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
+                sendfilePollset = allocatePoller(size, pool, soTimeout);
             }
             if (sendfilePollset == 0) {
                 size = 62;
-                sendfilePollset = allocatePoller(size, pool, keepAliveTimeout);
+                sendfilePollset = allocatePoller(size, pool, soTimeout);
             }
             desc = new long[size * 2];
             sendfileData = new HashMap<Long, SendfileData>(size);