tomcat-dev mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1144276&view=rev
Log:
Completely align process methods

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProtocol.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=1144276&r1=1144275&r2=1144276&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:56:33 2011
@@ -134,9 +134,14 @@ public class AjpAprProtocol extends Abst
          * required.
          */
         public void release(SocketWrapper<Long> socket,
-                AjpAprProcessor processor, boolean isSocketClosing) {
+                AjpAprProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
             processor.recycle(isSocketClosing);
             recycledProcessors.offer(processor);
+            if (addToPoller) {
+                ((AprEndpoint)proto.endpoint).getPoller().add(
+                        socket.getSocket().longValue());
+            }
         }
 
 
@@ -176,12 +181,10 @@ 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.
-                    release(socket, processor, false);
-                    ((AprEndpoint)proto.endpoint).getPoller().add(
-                            socket.getSocket().longValue());
+                    release(socket, processor, false, true);
                 } else {
                     // Connection closed. OK to recycle the processor.
-                    release(socket, processor, true);
+                    release(socket, processor, true, false);
                 }
                 return state;
             } catch(java.net.SocketException e) {
@@ -203,7 +206,7 @@ public class AjpAprProtocol extends Abst
                 // less-than-verbose logs.
                 log.error(sm.getString("ajpprotocol.proto.error"), e);
             }
-            release(socket, processor, true);
+            release(socket, processor, true, false);
             return SocketState.CLOSED;
         }
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProtocol.java?rev=1144276&r1=1144275&r2=1144276&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProtocol.java Fri Jul  8 11:56:33 2011
@@ -163,17 +163,21 @@ public class AjpNioProtocol extends Abst
             }
         }
 
-
         /**
          * Expected to be used by the handler once the processor is no longer
          * required.
          */
         public void release(SocketWrapper<NioChannel> socket,
-                AjpNioProcessor processor, boolean isSocketClosing) {
+                AjpNioProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
             processor.recycle(isSocketClosing);
             recycledProcessors.offer(processor);
+            if (addToPoller) {
+                socket.getSocket().getPoller().add(socket.getSocket());
+            }
         }
 
+
         @Override
         public SocketState process(SocketWrapper<NioChannel> socket,
                 SocketStatus status) {
@@ -210,11 +214,10 @@ public class AjpNioProtocol extends Abst
                 } else if (state == SocketState.OPEN){
                     // In keep-alive but between requests. OK to recycle
                     // processor. Continue to poll for the next request.
-                    release(socket, processor, false);
-                    socket.getSocket().getPoller().add(socket.getSocket());
+                    release(socket, processor, false, true);
                 } else {
                     // Connection closed. OK to recycle the processor.
-                    release(socket, processor, true);
+                    release(socket, processor, true, false);
                 }
                 return state;
             } catch(java.net.SocketException e) {
@@ -236,7 +239,7 @@ public class AjpNioProtocol extends Abst
                 // less-than-verbose logs.
                 log.error(sm.getString("ajpprotocol.proto.error"), e);
             }
-            release(socket, processor, true);
+            release(socket, processor, true, false);
             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=1144276&r1=1144275&r2=1144276&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:56:33 2011
@@ -127,9 +127,15 @@ public class AjpProtocol extends Abstrac
         /**
          * Expected to be used by the handler once the processor is no longer
          * required.
+         * 
+         * @param socket            Ignored for BIO
+         * @param processor
+         * @param isSocketClosing
+         * @param addToPoller       Ignored for BIO
          */
         public void release(SocketWrapper<Socket> socket,
-                AjpProcessor processor, boolean isSocketClosing) {
+                AjpProcessor processor, boolean isSocketClosing,
+                boolean addToPoller) {
             processor.recycle(isSocketClosing);
             recycledProcessors.offer(processor);
         }
@@ -171,10 +177,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.
-                    release(socket, processor, false);
+                    release(socket, processor, false, true);
                 } else {
                     // Connection closed. OK to recycle the processor.
-                    release(socket, processor, true);
+                    release(socket, processor, true, false);
                 }
                 return state;
             } catch(java.net.SocketException e) {
@@ -196,7 +202,7 @@ public class AjpProtocol extends Abstrac
                 // less-than-verbose logs.
                 log.error(sm.getString("ajpprotocol.proto.error"), e);
             }
-            release(socket, processor, true);
+            release(socket, processor, true, false);
             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