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

Method run

webapps/examples/WEB-INF/classes/async/Async2.java:44–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42 actx.setTimeout(30*1000);
43 Runnable run = new Runnable() {
44 @Override
45 public void run() {
46 try {
47 Thread.currentThread().setName("Async2-Thread");
48 log.info("Putting AsyncThread to sleep");
49 Thread.sleep(2*1000);
50 log.info("Writing data.");
51 Date date = new Date(System.currentTimeMillis());
52 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
53 actx.getResponse().getWriter().write(
54 "Output from background thread. Time: " + sdf.format(date) + "\n");
55 actx.complete();
56 }catch (InterruptedException | IllegalStateException | IOException x) {
57 log.error("Async2",x);
58 }
59 }
60 };
61 Thread t = new Thread(run);
62 t.start();

Callers

nothing calls this directly

Calls 8

setNameMethod · 0.65
infoMethod · 0.65
writeMethod · 0.65
getWriterMethod · 0.65
getResponseMethod · 0.65
formatMethod · 0.65
completeMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected