5455565758596061626364
public void run() { c.incr(); } }); } tk.shutdown(); tk.awaitTermination(1, TimeUnit.DAYS); assertEquals("all 3 task is executed", 3, c.x); } @Test
7475767778798081828384
sleep(); c.incr(); } }); } tk.shutdown(); tk.awaitTermination(1, TimeUnit.DAYS); assertEquals("only one task is executed", 1, c.x); } protected void sleep() {
5960616263646566676869
7980818283848586878889