tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1144272 - in /tomcat/trunk/java/org/apache/coyote/ajp: AjpAprProtocol.java AjpProtocol.java
Date Fri, 08 Jul 2011 11:49:50 GMT
Author: markt
Date: Fri Jul  8 11:49:50 2011
New Revision: 1144272

URL: http://svn.apache.org/viewvc?rev=1144272&view=rev
Log:
Align the process methods some more.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=1144272&r1=1144271&r2=1144272&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Fri Jul  8 11:49:50 2011
@@ -129,6 +129,17 @@ public class AjpAprProtocol extends Abst
             recycledProcessors.clear();
         }
         
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         */
+        public void release(SocketWrapper<Long> socket,
+                AjpAprProcessor processor, boolean isSocketClosing) {
+            processor.recycle(isSocketClosing);
+            recycledProcessors.offer(processor);
+        }
+
+
         @Override
         public SocketState process(SocketWrapper<Long> socket,
                 SocketStatus status) {
@@ -165,13 +176,12 @@ public class AjpAprProtocol extends Abst
                 } else if (state == SocketState.OPEN){
                     // In keep-alive but between requests. OK to recycle
                     // processor. Continue to poll for the next request.
-                    processor.recycle(false);
-                    recycledProcessors.offer(processor);
+                    release(socket, processor, false);
                     ((AprEndpoint)proto.endpoint).getPoller().add(
                             socket.getSocket().longValue());
                 } else {
-                    processor.recycle(true);
-                    recycledProcessors.offer(processor);
+                    // Connection closed. OK to recycle the processor.
+                    release(socket, processor, true);
                 }
                 return state;
             } catch(java.net.SocketException e) {
@@ -193,8 +203,7 @@ public class AjpAprProtocol extends Abst
                 // less-than-verbose logs.
                 log.error(sm.getString("ajpprotocol.proto.error"), e);
             }
-            processor.recycle(true);
-            recycledProcessors.offer(processor);
+            release(socket, processor, true);
             return SocketState.CLOSED;
         }
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?rev=1144272&r1=1144271&r2=1144272&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Fri Jul  8 11:49:50 2011
@@ -123,7 +123,18 @@ public class AjpProtocol extends Abstrac
         public void recycle() {
             recycledProcessors.clear();
         }
-        
+
+        /**
+         * Expected to be used by the handler once the processor is no longer
+         * required.
+         */
+        public void release(SocketWrapper<Socket> socket,
+                AjpProcessor processor, boolean isSocketClosing) {
+            processor.recycle(isSocketClosing);
+            recycledProcessors.offer(processor);
+        }
+
+
         @Override
         public SocketState process(SocketWrapper<Socket> socket,
                 SocketStatus status) {
@@ -160,11 +171,10 @@ public class AjpProtocol extends Abstrac
                 } else if (state == SocketState.OPEN){
                     // In keep-alive but between requests. OK to recycle
                     // processor. Continue to poll for the next request.
-                    processor.recycle(false);
-                    recycledProcessors.offer(processor);
+                    release(socket, processor, false);
                 } else {
-                    processor.recycle(true);
-                    recycledProcessors.offer(processor);
+                    // Connection closed. OK to recycle the processor.
+                    release(socket, processor, true);
                 }
                 return state;
             } catch(java.net.SocketException e) {
@@ -186,8 +196,7 @@ public class AjpProtocol extends Abstrac
                 // less-than-verbose logs.
                 log.error(sm.getString("ajpprotocol.proto.error"), e);
             }
-            processor.recycle(true);
-            recycledProcessors.offer(processor);
+            release(socket, processor, true);
             return SocketState.CLOSED;
         }
 



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


Mime
View raw message