MCPcopy Create free account
hub / github.com/btraceio/btrace / start

Method start

integration-tests/src/test/java/resources/TestApp.java:36–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 */
35abstract public class TestApp implements TestPrinter {
36 final public void start() throws Exception {
37 Thread t = new Thread(new Runnable() {
38 @Override
39 public void run() {
40 startWork();
41 }
42 }, "Worker Thread");
43 System.out.println("ready:" + getPID());
44 System.out.flush();
45 t.setDaemon(true);
46 t.start();
47
48 do {
49 String resp = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8)).readLine();
50 System.out.println("Received " + resp + " - " + "done".contains(resp));
51 if ("done".contains(resp)) {
52 System.out.flush();
53 System.out.println(System.currentTimeMillis() + ": Interrupting the worker thread");
54 t.interrupt();
55 System.out.println(System.currentTimeMillis() + ": Waiting for the worker thread to finish");
56 t.join(1000);
57 if (t.isAlive()) {
58 Thread.dumpStack();
59 throw new RuntimeException("Dangling worker thread");
60 }
61 System.out.println(System.currentTimeMillis() + ": Worker thread finished");
62 break;
63 }
64 } while (true);
65 }
66
67 private static long getPID() {
68 String processName

Callers 6

mainMethod · 0.45
testMethod · 0.45
TestAppMethod · 0.45
launchTestAppMethod · 0.45
runBTraceMethod · 0.45
attachMethod · 0.45

Calls 5

getPIDMethod · 0.95
joinMethod · 0.80
printlnMethod · 0.45
flushMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected