Commit f2e2561f authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch15] Book version of the code that Runs the Runnable

parent b27dea1f
Loading
Loading
Loading
Loading
+14 −2
Changes for src/main/java/ch15/MyRunnable.java: 14 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -11,11 +11,22 @@ public class MyRunnable implements Runnable {
   }

   public void doMore() {
      System.out.println(Thread.currentThread().getName() + ": top o’ the stack \n" + StackUtils.getCurrentStack());
      System.out.println(Thread.currentThread().getName() + ": top o’ the stack");
      Thread.dumpStack();
   }

}

class RunTester {
   public static void main(String[] args) {
      MyRunnable runnable = new MyRunnable();
      runnable.run();

      System.out.println(Thread.currentThread().getName() + ": back in main");
      Thread.dumpStack();
   }
}

class ThreadTester {
   public static void main (String[] args) {
      Runnable threadJob = new MyRunnable();
@@ -23,7 +34,8 @@ class ThreadTester {

      myThread.start();

      System.out.println(Thread.currentThread().getName() + ": back in main \n" + StackUtils.getCurrentStack());
      System.out.println(Thread.currentThread().getName() + ": back in main");
      Thread.dumpStack();
   }
}