[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-dev
Subject:    svn commit: r1003177 - in /tomcat/trunk/java/org/apache/coyote/ajp:
From:       markt () apache ! org
Date:       2010-09-30 17:35:35
Message-ID: 20100930173535.C3AC7238890D () eris ! apache ! org
[Download RAW message or body]

Author: markt
Date: Thu Sep 30 17:35:35 2010
New Revision: 1003177

URL: http://svn.apache.org/viewvc?rev=1003177&view=rev
Log:
Fix the root cause of the previous TCK failures (badly re-factored flush()) and \
restore the changes that were just working around the symptoms (poller stuff). \
Servlet 3.0 passes for the AJP/APR connector as of this commit.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1003177&r1=1003176&r2=1003177&view=diff
 ==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Thu Sep 30 \
17:35:35 2010 @@ -233,7 +233,7 @@ public abstract class AbstractAjpProcess
            }
 
            try {
-               flush();
+               flush(false);
            } catch (IOException e) {
                // Set error flag
                error = true;
@@ -253,7 +253,7 @@ public abstract class AbstractAjpProcess
            }
 
            try {
-               flush();
+               flush(true);
            } catch (IOException e) {
                // Set error flag
                error = true;
@@ -358,7 +358,7 @@ public abstract class AbstractAjpProcess
    
    // Methods called by action()
    protected abstract void actionInternal(ActionCode actionCode, Object param);
-   protected abstract void flush() throws IOException;
+   protected abstract void flush(boolean tbd) throws IOException;
    protected abstract void finish() throws IOException;
    
    

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1003177&r1=1003176&r2=1003177&view=diff
 ==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Thu Sep 30 17:35:35 \
2010 @@ -319,6 +319,13 @@ public class AjpAprProcessor extends Abs
 
         }
 
+        // Add the socket to the poller
+        if (!error && !endpoint.isPaused()) {
+            if (!isAsync()) {
+                ((AprEndpoint)endpoint).getPoller().add(socketRef);
+            }
+        }
+
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
         
         if (error || endpoint.isPaused()) {
@@ -451,10 +458,10 @@ public class AjpAprProcessor extends Abs
 
         // Add the end message
         if (outputBuffer.position() + endMessageArray.length > \
                outputBuffer.capacity()) {
-            flush();
+            flush(false);
         }
         outputBuffer.put(endMessageArray);
-        flush();
+        flush(false);
 
     }
 
@@ -645,7 +652,7 @@ public class AjpAprProcessor extends Abs
      * Callback to write data from the buffer.
      */
     @Override
-    protected void flush() throws IOException {
+    protected void flush(boolean explicit) throws IOException {
         
         long socketRef = socket.getSocket().longValue();
         
@@ -656,11 +663,12 @@ public class AjpAprProcessor extends Abs
             outputBuffer.clear();
         }
         // Send explicit flush message
-        if (Socket.sendb(socketRef, flushMessageBuffer, 0,
-                flushMessageBuffer.position()) < 0) {
-            throw new IOException(sm.getString("ajpprocessor.failedflush"));
+        if (explicit) {
+            if (Socket.sendb(socketRef, flushMessageBuffer, 0,
+                    flushMessageBuffer.position()) < 0) {
+                throw new IOException(sm.getString("ajpprocessor.failedflush"));
+            }
         }
-
     }
 
 
@@ -705,7 +713,7 @@ public class AjpAprProcessor extends Abs
                 len -= thisTime;
                 if (outputBuffer.position() + thisTime +
                     Constants.H_SIZE + 4 > outputBuffer.capacity()) {
-                    flush();
+                    flush(false);
                 }
                 outputBuffer.put((byte) 0x41);
                 outputBuffer.put((byte) 0x42);

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=1003177&r1=1003176&r2=1003177&view=diff
 ==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Thu Sep 30 17:35:35 \
2010 @@ -481,9 +481,9 @@ public class AjpAprProtocol 
                     if (state != SocketState.LONG && state != SocketState.ASYNC_END) \
{  connections.remove(socket);
                         recycledProcessors.offer(result);
-                        //if (state == SocketState.OPEN) {
-                        //    \
                proto.endpoint.getPoller().add(socket.getSocket().longValue());
-                        //}
+                        if (state == SocketState.OPEN) {
+                            \
proto.endpoint.getPoller().add(socket.getSocket().longValue()); +                     \
}  }
                 }
             }

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1003177&r1=1003176&r2=1003177&view=diff
 ==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Sep 30 17:35:35 \
2010 @@ -577,7 +577,7 @@ public class AjpProcessor extends Abstra
      * Callback to write data from the buffer.
      */
     @Override
-    protected void flush() throws IOException {
+    protected void flush(boolean explicit) throws IOException {
         // Send the flush message
         output.write(flushMessageArray);
     }



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic