1 package groovy; 2 3 public class TestInterruptor implements Runnable{ 4 private Thread caller; 5 6 public TestInterruptor(Thread caller) { 7 this.caller = caller; 8 } 9 10 public void run(){ 11 try { 12 Thread.currentThread().sleep(100); // enforce yield, so we have something to interrupt 13 } catch (InterruptedException e) { 14 // ignore 15 } 16 caller.interrupt(); 17 } 18 }