tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1519465 - /tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Date Mon, 02 Sep 2013 15:44:31 GMT
Author: markt
Date: Mon Sep  2 15:44:31 2013
New Revision: 1519465

URL: http://svn.apache.org/r1519465
Log:
Enable AJP to work with Servlet 3.1 non-blocking reads. This is not a true non-blocking implementation.
That requires further investigation marked by the TODOs in the code.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.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=1519465&r1=1519464&r2=1519465&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Mon Sep  2 15:44:31
2013
@@ -44,6 +44,7 @@ import org.apache.tomcat.util.http.HttpM
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.net.AbstractEndpoint;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
+import org.apache.tomcat.util.net.DispatchType;
 import org.apache.tomcat.util.net.SSLSupport;
 import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
@@ -515,17 +516,34 @@ public abstract class AbstractAjpProcess
                     sm.getString("ajpprocessor.comet.notsupported"));
 
         } else if (actionCode == ActionCode.AVAILABLE) {
-            // TODO
+            // Web Server only sends data when asked so unless end of stream has
+            // been reached, there should be data available.
+            // TODO Figure out if a 'true' non-blocking approach is possible
+            //      for AJP and what changes would be required to support it.
+            if (!endOfStream) {
+                request.setAvailable(1);
+            }
+
         } else if (actionCode == ActionCode.NB_WRITE_INTEREST) {
-            // TODO
+            // Assume it is always possible write data.
+            // TODO Investigate 'true' non-blocking IO for AJP.
+            AtomicBoolean isReady = (AtomicBoolean)param;
+            isReady.set(true);
+
         } else if (actionCode == ActionCode.NB_READ_INTEREST) {
             // TODO
+            System.out.println("AJP Non-blocking IO TODO: NB_READ_INTEREST");
+
         } else if (actionCode == ActionCode.REQUEST_BODY_FULLY_READ) {
-            // TODO
+            AtomicBoolean result = (AtomicBoolean) param;
+            result.set(endOfStream);
+
         } else if (actionCode == ActionCode.DISPATCH_READ) {
-            // TODO
+            socketWrapper.addDispatch(DispatchType.NON_BLOCKING_READ);
+
         } else if (actionCode == ActionCode.DISPATCH_WRITE) {
-            // TODO
+            socketWrapper.addDispatch(DispatchType.NON_BLOCKING_WRITE);
+
         }  else {
             actionInternal(actionCode, param);
         }



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


Mime
View raw message