Skip to content

Commit 3c05679

Browse files
committed
Polishing
See gh-30762
1 parent d8729a7 commit 3c05679

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

spring-context/src/main/java/org/springframework/scheduling/concurrent/ConcurrentTaskScheduler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,9 @@ public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
212212

213213
@Override
214214
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
215-
Duration initialDelay = Duration.between(this.clock.instant(), startTime);
215+
Duration delay = Duration.between(this.clock.instant(), startTime);
216216
try {
217-
return this.scheduledExecutor.schedule(decorateTask(task, false),
218-
NANO.convert(initialDelay), NANO);
217+
return this.scheduledExecutor.schedule(decorateTask(task, false), NANO.convert(delay), NANO);
219218
}
220219
catch (RejectedExecutionException ex) {
221220
throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);

spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,9 @@ public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
383383
@Override
384384
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
385385
ScheduledExecutorService executor = getScheduledExecutor();
386-
Duration initialDelay = Duration.between(this.clock.instant(), startTime);
386+
Duration delay = Duration.between(this.clock.instant(), startTime);
387387
try {
388-
return executor.schedule(errorHandlingTask(task, false),
389-
NANO.convert(initialDelay), NANO);
388+
return executor.schedule(errorHandlingTask(task, false), NANO.convert(delay), NANO);
390389
}
391390
catch (RejectedExecutionException ex) {
392391
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);

0 commit comments

Comments
 (0)