| Home >> All |
Source code: maddany/TimerThread.java
1 package maddany; 2 3 public class TimerThread extends Thread { 4 private Wakable target; 5 private int delay; 6 7 public TimerThread(Wakable target, int ttw) { 8 super(); 9 this.target = target; 10 delay = ttw; 11 } 12 13 public void run() { 14 try { 15 while(true) { 16 super.sleep(delay); 17 target.wakeUp(); 18 } 19 } catch(InterruptedException e) { 20 e.printStackTrace(); 21 } 22 } 23 }