Use Timer identifier when rescheduling the timer (#3095)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>pull/2553/merge
parent
6d6250eb63
commit
93a8a214cf
|
@ -40,7 +40,8 @@ public class TimerImpl implements Timer {
|
||||||
this(scheduler, startTime, runnable, null);
|
this(scheduler, startTime, runnable, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimerImpl(Scheduler scheduler, ZonedDateTime startTime, SchedulerRunnable runnable, @Nullable String identifier) {
|
public TimerImpl(Scheduler scheduler, ZonedDateTime startTime, SchedulerRunnable runnable,
|
||||||
|
@Nullable String identifier) {
|
||||||
this.scheduler = scheduler;
|
this.scheduler = scheduler;
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
this.runnable = runnable;
|
this.runnable = runnable;
|
||||||
|
@ -57,7 +58,7 @@ public class TimerImpl implements Timer {
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean reschedule(ZonedDateTime newTime) {
|
public synchronized boolean reschedule(ZonedDateTime newTime) {
|
||||||
future.cancel(false);
|
future.cancel(false);
|
||||||
future = scheduler.schedule(runnable, newTime.toInstant());
|
future = scheduler.schedule(runnable, identifier, newTime.toInstant());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue