Author: remm
Date: Thu May 21 17:11:49 2015
New Revision: 1680928

URL: http://svn.apache.org/r1680928
Log:
Drop useCaches from NIO2 and fix issue in doc.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
    tomcat/trunk/webapps/docs/config/http.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1680928&r1=1680927&r2=1680928&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu May 21 
17:11:49 2015
@@ -100,14 +100,6 @@ public class Nio2Endpoint extends Abstra
 
 
     /**
-     * Use the object caches to reduce GC at the expense of additional memory 
use.
-     */
-    private boolean useCaches = true;
-    public void setUseCaches(boolean useCaches) { this.useCaches = useCaches; }
-    public boolean getUseCaches() { return useCaches; }
-
-
-    /**
      * Handling of accepted sockets.
      */
     private Handler handler = null;
@@ -153,10 +145,8 @@ public class Nio2Endpoint extends Abstra
 
 
     protected void releaseCaches() {
-        if (useCaches) {
-            this.nioChannels.clear();
-            this.processorCache.clear();
-        }
+        this.nioChannels.clear();
+        this.processorCache.clear();
         if ( handler != null ) handler.recycle();
     }
 
@@ -221,12 +211,10 @@ public class Nio2Endpoint extends Abstra
             running = true;
             paused = false;
 
-            if (useCaches) {
-                processorCache = new 
SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
-                        socketProperties.getProcessorCache());
-                nioChannels = new 
SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
-                        socketProperties.getBufferPool());
-            }
+            processorCache = new 
SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
+                    socketProperties.getProcessorCache());
+            nioChannels = new 
SynchronizedStack<>(SynchronizedStack.DEFAULT_SIZE,
+                    socketProperties.getBufferPool());
 
             // Create worker collection
             if ( getExecutor() == null ) {
@@ -277,10 +265,8 @@ public class Nio2Endpoint extends Abstra
                     }
                 }
             });
-            if (useCaches) {
-                nioChannels.clear();
-                processorCache.clear();
-            }
+            nioChannels.clear();
+            processorCache.clear();
         }
     }
 
@@ -355,7 +341,7 @@ public class Nio2Endpoint extends Abstra
         try {
             socketProperties.setProperties(socket);
 
-            Nio2Channel channel = (useCaches) ? nioChannels.pop() : null;
+            Nio2Channel channel = nioChannels.pop();
             if (channel == null) {
                 SocketBufferHandler bufhandler = new SocketBufferHandler(
                         socketProperties.getAppReadBufSize(),
@@ -407,7 +393,7 @@ public class Nio2Endpoint extends Abstra
 
     protected boolean processSocket0(SocketWrapperBase<Nio2Channel> 
socketWrapper, SocketStatus status, boolean dispatch) {
         try {
-            SocketProcessor sc = (useCaches) ? processorCache.pop() : null;
+            SocketProcessor sc = processorCache.pop();
             if (sc == null) {
                 sc = new SocketProcessor(socketWrapper, status);
             } else {
@@ -1664,7 +1650,7 @@ public class Nio2Endpoint extends Abstra
                         if (state == SocketState.CLOSED) {
                             // Close socket and pool
                             closeSocket(socket);
-                            if (useCaches && running && !paused) {
+                            if (running && !paused) {
                                 nioChannels.push(socket.getSocket());
                             }
                         } else if (state == SocketState.UPGRADING) {
@@ -1673,7 +1659,7 @@ public class Nio2Endpoint extends Abstra
                         }
                     } else if (handshake == -1 ) {
                         closeSocket(socket);
-                        if (useCaches && running && !paused) {
+                        if (running && !paused) {
                             nioChannels.push(socket.getSocket());
                         }
                     }
@@ -1698,7 +1684,7 @@ public class Nio2Endpoint extends Abstra
                     socket = null;
                     status = null;
                     //return to cache
-                    if (useCaches && running && !paused) {
+                    if (running && !paused) {
                         processorCache.push(this);
                     }
                 }

Modified: tomcat/trunk/webapps/docs/config/http.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1680928&r1=1680927&r2=1680928&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/http.xml (original)
+++ tomcat/trunk/webapps/docs/config/http.xml Thu May 21 17:11:49 2015
@@ -786,12 +786,6 @@
 
     <attributes>
 
-      <attribute name="useCaches" required="false">
-        <p>(bool)Use this attribute to enable or disable object caching to
-        reduce the amount of GC objects produced.
-        The default value is <code>false</code>.</p>
-      </attribute>
-
       <attribute name="useSendfile" required="false">
         <p>(bool)Use this attribute to enable or disable sendfile capability.
         The default value is <code>true</code>. Note that the use of sendfile
@@ -841,7 +835,7 @@
         dealing with tens of thousands concurrent connections.</p>
       </attribute>
 
-      <attribute name="socket.bufferPoolSize" required="false">
+      <attribute name="socket.bufferPool" required="false">
         <p>(int)The NIO2 connector uses a class called Nio2Channel that holds
         elements linked to a socket. To reduce garbage collection, the NIO2
         connector caches these channel objects. This value specifies the size 
of



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

Reply via email to