merge with 2.0.0-m3

This commit is contained in:
Sebastian Sdorra
2019-06-25 09:53:44 +02:00
45 changed files with 246 additions and 159 deletions

View File

@@ -30,7 +30,7 @@ final class CronExpression {
boolean shouldRun(ZonedDateTime time) {
ZonedDateTime now = ZonedDateTime.now(clock);
return time.isBefore(now);
return time.isBefore(now) || time.isEqual(now);
}
Optional<ZonedDateTime> calculateNextRun() {

View File

@@ -32,7 +32,7 @@ class CronTask implements Task, Runnable {
@Override
public synchronized void run() {
if (expression.shouldRun(nextRun)) {
if (hasNextRun() && expression.shouldRun(nextRun)) {
LOG.debug("execute task {}, because of matching expression {}", name, expression);
runnable.run();
Optional<ZonedDateTime> next = expression.calculateNextRun();
@@ -40,6 +40,7 @@ class CronTask implements Task, Runnable {
nextRun = next.get();
} else {
LOG.debug("cancel task {}, because expression {} has no next execution", name, expression);
nextRun = null;
cancel();
}
} else {