Use Timer identifier when rescheduling the timer (#3095)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
pull/2553/merge
Christoph Weitkamp 2022-09-29 14:05:09 +02:00 committed by GitHub
parent 6d6250eb63
commit 93a8a214cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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;
} }