use of io.spine.time.Interval in project core-java by SpineEventEngine.
the class Rescheduler method reschedule.
private void reschedule(Command command) {
final Timestamp now = getCurrentTime();
final Timestamp timeToPost = getTimeToPost(command);
if (isLaterThan(now, /*than*/
timeToPost)) {
onScheduledCommandExpired(command);
} else {
final Interval interval = Intervals.between(now, timeToPost);
final Duration newDelay = Intervals.toDuration(interval);
final Command updatedCommand = CommandScheduler.setSchedule(command, newDelay, now);
scheduler().schedule(updatedCommand);
}
}
Aggregations