Changed the DelayTimer to use Runnable instead of it's own

This commit is contained in:
nathan 2015-12-17 02:05:23 +01:00
parent 72a4380383
commit bffa46cd27

View File

@ -22,12 +22,12 @@ public
class DelayTimer {
private final String name;
private final boolean isDaemon;
private final Callback listener;
private final Runnable listener;
private Timer timer;
private long delay;
public
DelayTimer(Callback listener) {
DelayTimer(Runnable listener) {
this(null, true, listener);
}
@ -39,7 +39,7 @@ class DelayTimer {
* @param listener the callback listener to execute
*/
public
DelayTimer(String name, boolean isDaemon, Callback listener) {
DelayTimer(String name, boolean isDaemon, Runnable listener) {
this.name = name;
this.listener = listener;
this.isDaemon = isDaemon;
@ -85,14 +85,14 @@ class DelayTimer {
@Override
public
void run() {
DelayTimer.this.listener.execute();
DelayTimer.this.listener.run();
DelayTimer.this.cancel();
}
};
this.timer.schedule(t, delay);
}
else {
this.listener.execute();
this.listener.run();
this.timer = null;
}
}
@ -101,10 +101,4 @@ class DelayTimer {
long getDelay() {
return this.delay;
}
public
interface Callback {
public
void execute();
}
}