Add in configuration options to control the application buffers associated with a...
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 22 Feb 2007 20:11:50 +0000 (20:11 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 22 Feb 2007 20:11:50 +0000 (20:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@510639 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioEndpoint.java
java/org/apache/tomcat/util/net/SocketProperties.java
webapps/docs/config/http.xml

index 7fc88c8..943de1e 100644 (file)
@@ -807,13 +807,13 @@ public class NioEndpoint {
                 if (sslContext != null) {
                     SSLEngine engine = createSSLEngine();
                     int appbufsize = engine.getSession().getApplicationBufferSize();
-                    NioBufferHandler bufhandler = new NioBufferHandler(Math.max(appbufsize,getReadBufSize()),
-                                                                       Math.max(appbufsize,getWriteBufSize()),
+                    NioBufferHandler bufhandler = new NioBufferHandler(Math.max(appbufsize,socketProperties.getAppReadBufSize()),
+                                                                       Math.max(appbufsize,socketProperties.getAppWriteBufSize()),
                                                                        socketProperties.getDirectBuffer());
                     channel = new SecureNioChannel(socket, engine, bufhandler, selectorPool);
                 } else {
-                    NioBufferHandler bufhandler = new NioBufferHandler(getReadBufSize(),
-                                                                       getWriteBufSize(),
+                    NioBufferHandler bufhandler = new NioBufferHandler(socketProperties.getAppReadBufSize(),
+                                                                       socketProperties.getAppWriteBufSize(),
                                                                        socketProperties.getDirectBuffer());
 
                     channel = new NioChannel(socket, bufhandler);
index 8a2a726..f7569d2 100644 (file)
@@ -62,6 +62,18 @@ public class SocketProperties {
     protected int txBufSize = 43800;\r
     \r
     /**\r
+     * The application read buffer size in bytes.\r
+     * Default value is rxBufSize\r
+     */\r
+    protected int appReadBufSize = rxBufSize;\r
+    \r
+    /**\r
+     * The application write buffer size in bytes\r
+     * Default value is txBufSize\r
+     */\r
+    protected int appWriteBufSize = txBufSize;\r
+    \r
+    /**\r
      * NioChannel pool size for the endpoint,\r
      * this value is how many channels\r
      * -1 means unlimited cached, 0 means no cache\r
@@ -223,6 +235,14 @@ public class SocketProperties {
         return properties;\r
     }\r
 \r
+    public int getAppReadBufSize() {\r
+        return appReadBufSize;\r
+    }\r
+\r
+    public int getAppWriteBufSize() {\r
+        return appWriteBufSize;\r
+    }\r
+\r
     public int getDirectBufferPool() {\r
         return bufferPool;\r
     }\r
@@ -299,6 +319,14 @@ public class SocketProperties {
         this.keyCache = keyCache;\r
     }\r
 \r
+    public void setAppReadBufSize(int appReadBufSize) {\r
+        this.appReadBufSize = appReadBufSize;\r
+    }\r
+\r
+    public void setAppWriteBufSize(int appWriteBufSize) {\r
+        this.appWriteBufSize = appWriteBufSize;\r
+    }\r
+\r
     public void setDirectBufferPool(int directBufferPool) {\r
         this.bufferPool = directBufferPool;\r
     }\r
index f4e17ec..51e5798 100644 (file)
       <attribute name="socket.txBufSize" required="false">
         <p>The socket send buffer (SO_SNDBUF) size in bytes. Default value is 43800</p>
       </attribute>
+      <attribute name="socket.appReadBufSize" required="false">
+        <p>Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer
+           This attribute controls the size of these buffers. By default this read buffer is sized to match the 
+           socket read buffer (SO_RCVBUF) value, but can be sized separately.</p>
+      </attribute>
+      <attribute name="socket.appWriteBufSize" required="false">
+        <p>Each connection that is opened up in Tomcat get associated with a read and a write ByteBuffer
+           This attribute controls the size of these buffers. By default this write buffer is sized to match the 
+           socket read buffer (SO_SNDBUF) value, but can be sized separately.</p>
+      </attribute>
       <attribute name="socket.bufferPool" required="false">
         <p>The Nio connector uses a class called NioChannel that holds elements linked to a socket.
            To reduce garbage collection, the Nio connector caches these channel objects.