MCPcopy Create free account
hub / github.com/apache/tomcat / service

Method service

webapps/examples/WEB-INF/classes/async/Async1.java:36–57  ·  view source on GitHub ↗
(HttpServletRequest req, HttpServletResponse resp)

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 3

setTimeoutMethod · 0.95
startAsyncMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected