You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2010/03/26 16:21:39 UTC

svn commit: r927911 - in /tomcat/trunk/webapps/examples/WEB-INF/classes/async: Async0.java Async3.java

Author: fhanik
Date: Fri Mar 26 15:21:39 2010
New Revision: 927911

URL: http://svn.apache.org/viewvc?rev=927911&view=rev
Log:
Adjust examples to the latest implementation

Modified:
    tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async0.java
    tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async3.java

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async0.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async0.java?rev=927911&r1=927910&r2=927911&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async0.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async0.java Fri Mar 26 15:21:39 2010
@@ -34,8 +34,8 @@ public class Async0 extends HttpServlet 
     private static final Log log = LogFactory.getLog(Async0.class);
 
     @Override
-    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        if (req.isAsyncStarted()) {
+    protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
+        if (Boolean.TRUE == req.getAttribute("dispatch")) {
             log.info("Received dispatch, completing on the worker thread.");
             req.getAsyncContext().complete();
             log.info("After complete called started:"+req.isAsyncStarted());
@@ -47,6 +47,7 @@ public class Async0 extends HttpServlet 
             Runnable run = new Runnable() {
                 public void run() {
                     try {
+                        req.setAttribute("dispatch", Boolean.TRUE);
                         Thread.currentThread().setName("Async0-Thread");
                         log.info("Putting AsyncThread to sleep");
                         Thread.sleep(2*1000);

Modified: tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async3.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async3.java?rev=927911&r1=927910&r2=927911&view=diff
==============================================================================
--- tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async3.java (original)
+++ tomcat/trunk/webapps/examples/WEB-INF/classes/async/Async3.java Fri Mar 26 15:21:39 2010
@@ -33,7 +33,6 @@ public class Async3 extends HttpServlet 
         final AsyncContext actx = req.startAsync();
         actx.setTimeout(30*1000);
         actx.dispatch("/jsp/async/async3.jsp");
-        actx.complete();
     }
     
 



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