Use maxThreads value as the default for maxConnections with the BIO connector.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 5 May 2011 15:53:57 +0000 (15:53 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 5 May 2011 15:53:57 +0000 (15:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099855 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/JIoEndpoint.java
webapps/docs/config/ajp.xml
webapps/docs/config/http.xml

index 4507430..440b7e6 100644 (file)
@@ -65,6 +65,14 @@ public class JIoEndpoint extends AbstractEndpoint {
     protected ServerSocket serverSocket = null;
     
 
+    // ------------------------------------------------------------ Constructor
+
+    public JIoEndpoint() {
+        // Set maxConnections to zero so we can tell if the user has specified
+        // their own value on the connector when we reach bind()
+        setMaxConnections(0);
+    }
+
     // ------------------------------------------------------------- Properties
 
     /**
@@ -351,6 +359,12 @@ public class JIoEndpoint extends AbstractEndpoint {
         if (acceptorThreadCount == 0) {
             acceptorThreadCount = 1;
         }
+        // Initialize maxConnections
+        if (getMaxConnections() == 0) {
+            // User hasn't set a value - use the default
+            setMaxConnections(getMaxThreads());
+        }
+
         if (serverSocketFactory == null) {
             if (isSSLEnabled()) {
                 serverSocketFactory =
index 08ed2bf..ccc13a6 100644 (file)
        connectionTimeout attribute.</p>
     </attribute>
 
+    <attribute name="maxConnections" required="false">
+      <p>The maximum number of connections that the server will accept and
+      process at any given time. When this number has been reached, the server
+      will not accept any more connections until the number of connections
+      falls below this value. The operating system may still accept
+      connections based on the <code>acceptCount</code> setting. Default value
+      varies by connector type. For BIO the default is the value of
+      <strong>maxThreads</strong>.For APR/native, the default is
+      <code>8192</code>.</p>
+      <p>Note that for APR/native on Windows, the configured value will be
+      reduced to the highest multiple of 1024 that is less than or equal to
+      maxConnections. This is done for performance reasons.</p>
+    </attribute>
+
     <attribute name="maxThreads" required="false">
       <p>The maximum number of request processing threads to be created
       by this <strong>Connector</strong>, which therefore determines the
index 4254071..4f999d5 100644 (file)
       will not accept any more connections until the number of connections
       falls below this value. The operating system may still accept
       connections based on the <code>acceptCount</code> setting. Default value
-      varies by connector type. For BIO and NIO the default is
-      <code>10000</code>. For APR/native, the default is <code>8192</code>.</p>
+      varies by connector type. For BIO the default is the value of
+      <strong>maxThreads</strong>. For NIO the default is <code>10000</code>.
+      For APR/native, the default is <code>8192</code>.</p>
       <p>Note that for APR/native on Windows, the configured value will be
       reduced to the highest multiple of 1024 that is less than or equal to
       maxConnections. This is done for performance reasons.</p>
 
     <p>Below is a small chart that shows how the connectors differentiate.</p>
     <source>
-                       Java Blocking Connector    Java Nio Blocking Connector      APR/native Connector
-                                 BIO                          NIO                          APR
-    Classname              Http11Protocol              Http11NioProtocol            Http11AprProtocol
-    Tomcat Version           3.x onwards                  6.x onwards                 5.5.x onwards
-    Support Polling              NO                           YES                          YES
-    Polling Size                 N/A             Unlimited - Restricted by mem   Unlimited - Configurable
-    Read HTTP Request         Blocking                   Non Blocking                    Blocking
-    Read HTTP Body            Blocking                   Sim Blocking                    Blocking
-    Write HTTP Response       Blocking                   Sim Blocking                    Blocking
-    SSL Support               Java SSL                     Java SSL                      OpenSSL
-    SSL Handshake             Blocking                   Non blocking                    Blocking
-    Max Connections        maxConnections              See polling size              See polling size
+                       Java Blocking Connector   Java Nio Blocking Connector   APR/native Connector
+                                 BIO                         NIO                       APR
+    Classname              Http11Protocol             Http11NioProtocol         Http11AprProtocol
+    Tomcat Version           3.x onwards                 6.x onwards              5.5.x onwards
+    Support Polling              NO                          YES                       YES
+    Polling Size                 N/A                   maxConnections             maxConnections
+    Read HTTP Request         Blocking                  Non Blocking                 Blocking
+    Read HTTP Body            Blocking                  Sim Blocking                 Blocking
+    Write HTTP Response       Blocking                  Sim Blocking                 Blocking
+    SSL Support               Java SSL                    Java SSL                   OpenSSL
+    SSL Handshake             Blocking                  Non blocking                 Blocking
+    Max Connections        maxConnections              maxConnections             maxConnections
     
     
     </source>