(HttpServletRequest req, HttpServletResponse resp)
| 34 | private static final Log log = LogFactory.getLog(Async1.class); |
| 35 | |
| 36 | @Override |
| 37 | protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { |
| 38 | final AsyncContext actx = req.startAsync(); |
| 39 | actx.setTimeout(30*1000); |
| 40 | Runnable run = new Runnable() { |
| 41 | @Override |
| 42 | public void run() { |
| 43 | try { |
| 44 | String path = "/jsp/async/async1.jsp"; |
| 45 | Thread.currentThread().setName("Async1-Thread"); |
| 46 | log.info("Putting AsyncThread to sleep"); |
| 47 | Thread.sleep(2*1000); |
| 48 | log.info("Dispatching to "+path); |
| 49 | actx.dispatch(path); |
| 50 | }catch (InterruptedException | IllegalStateException x) { |
| 51 | log.error("Async1",x); |
| 52 | } |
| 53 | } |
| 54 | }; |
| 55 | Thread t = new Thread(run); |
| 56 | t.start(); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | } |
nothing calls this directly
no test coverage detected