tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfcl...@apache.org
Subject svn commit: r940189 - /tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
Date Sun, 02 May 2010 10:02:57 GMT
Author: jfclere
Date: Sun May  2 10:02:56 2010
New Revision: 940189

URL: http://svn.apache.org/viewvc?rev=940189&view=rev
Log:
try to fix async for APR.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=940189&r1=940188&r2=940189&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Sun May  2 10:02:56
2010
@@ -924,6 +924,44 @@ public class Http11AprProcessor implemen
         
     }
 
+    /* Copied from the AjpProcessor.java */
+    public SocketState asyncDispatch(SocketStatus status) throws IOException {
+
+        RequestInfo rp = request.getRequestProcessor();
+        try {
+            rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
+            error = !adapter.asyncDispatch(request, response, status);
+        } catch (InterruptedIOException e) {
+            error = true;
+        } catch (Throwable t) {
+            log.error(sm.getString("http11processor.request.process"), t);
+            // 500 - Internal Server Error
+            response.setStatus(500);
+            error = true;
+        }
+
+        rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
+
+        if (async) {
+            if (error) {
+                response.setStatus(500);
+                request.updateCounters();
+                recycle();
+                return SocketState.CLOSED;
+            } else {
+                return SocketState.LONG;
+            }
+        } else {
+            if (error) {
+                response.setStatus(500);
+            }
+            request.updateCounters();
+            recycle();
+            return SocketState.CLOSED;
+        }
+        
+    }
+
     
     public void endRequest() {
         
@@ -1223,12 +1261,16 @@ public class Http11AprProcessor implemen
             //TODO SERVLET3 - async
             async = true;
         } else if (actionCode == ActionCode.ACTION_ASYNC_COMPLETE) {
-          //TODO SERVLET3 - async
+          //TODO SERVLET3 - async - that is bit hacky -
             AtomicBoolean dispatch = (AtomicBoolean)param;
             RequestInfo rp = request.getRequestProcessor();
             if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) { //async handling
                 dispatch.set(true);
-                // endpoint.processSocket(this.socket, SocketStatus.STOP);
+                try {
+                    asyncDispatch(SocketStatus.STOP); // What to do with return code ?
+                } catch (IOException ex) {
+                    error = true;
+                }
             } else {
                 dispatch.set(false);
             }



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


Mime
View raw message