parent
d8729a7c67
commit
3c05679a97
|
|
@ -212,10 +212,9 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
|
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
|
||||||
Duration initialDelay = Duration.between(this.clock.instant(), startTime);
|
Duration delay = Duration.between(this.clock.instant(), startTime);
|
||||||
try {
|
try {
|
||||||
return this.scheduledExecutor.schedule(decorateTask(task, false),
|
return this.scheduledExecutor.schedule(decorateTask(task, false), NANO.convert(delay), NANO);
|
||||||
NANO.convert(initialDelay), NANO);
|
|
||||||
}
|
}
|
||||||
catch (RejectedExecutionException ex) {
|
catch (RejectedExecutionException ex) {
|
||||||
throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
|
throw new TaskRejectedException("Executor [" + this.scheduledExecutor + "] did not accept task: " + task, ex);
|
||||||
|
|
|
||||||
|
|
@ -383,10 +383,9 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||||
@Override
|
@Override
|
||||||
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
|
public ScheduledFuture<?> schedule(Runnable task, Instant startTime) {
|
||||||
ScheduledExecutorService executor = getScheduledExecutor();
|
ScheduledExecutorService executor = getScheduledExecutor();
|
||||||
Duration initialDelay = Duration.between(this.clock.instant(), startTime);
|
Duration delay = Duration.between(this.clock.instant(), startTime);
|
||||||
try {
|
try {
|
||||||
return executor.schedule(errorHandlingTask(task, false),
|
return executor.schedule(errorHandlingTask(task, false), NANO.convert(delay), NANO);
|
||||||
NANO.convert(initialDelay), NANO);
|
|
||||||
}
|
}
|
||||||
catch (RejectedExecutionException ex) {
|
catch (RejectedExecutionException ex) {
|
||||||
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
|
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue