From: fhanik Date: Fri, 26 Mar 2010 15:21:39 +0000 (+0000) Subject: Adjust examples to the latest implementation X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e3ac7a153c608c725ca991c2b2af821ea61afcb5;p=tomcat7.0 Adjust examples to the latest implementation git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@927911 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/webapps/examples/WEB-INF/classes/async/Async0.java b/webapps/examples/WEB-INF/classes/async/Async0.java index 5a5af978e..194beb8f6 100644 --- a/webapps/examples/WEB-INF/classes/async/Async0.java +++ b/webapps/examples/WEB-INF/classes/async/Async0.java @@ -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); diff --git a/webapps/examples/WEB-INF/classes/async/Async3.java b/webapps/examples/WEB-INF/classes/async/Async3.java index f7bff30b3..37b7ed1b3 100644 --- a/webapps/examples/WEB-INF/classes/async/Async3.java +++ b/webapps/examples/WEB-INF/classes/async/Async3.java @@ -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(); }