Add a new method to the DelayedExecutor
This commit is contained in:
parent
5ebe6eb78a
commit
812b525460
1 changed files with 15 additions and 0 deletions
|
@ -60,6 +60,21 @@ public class DelayedExecutorService {
|
||||||
//EXECUTORS.add(exe);
|
//EXECUTORS.add(exe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void scheduleRepeating(final Runnable run, int seconds)
|
||||||
|
{
|
||||||
|
if(!Terminal.isRunning()) return;
|
||||||
|
|
||||||
|
TimerTask task = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
run.run();
|
||||||
|
scheduleRepeating(run, seconds);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
repeater.schedule(task, seconds*1000L);
|
||||||
|
}
|
||||||
|
|
||||||
private static void stopRepeatingThread()
|
private static void stopRepeatingThread()
|
||||||
{
|
{
|
||||||
repeater.cancel();
|
repeater.cancel();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue