This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 2a56568bfe30b404136a0c36a6c63dc518da56b6 Author: Alex Heneveld <[email protected]> AuthorDate: Fri Nov 11 11:01:12 2022 +0000 fix reporting of scheduled tasks that are no longer reporting --- .../java/org/apache/brooklyn/util/core/task/ScheduledTask.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ScheduledTask.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ScheduledTask.java index 00d6d2a9b3..9a6e0ccfbf 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/task/ScheduledTask.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ScheduledTask.java @@ -225,12 +225,18 @@ public class ScheduledTask extends BasicTask<Object> { Duration start = Duration.sinceUtc(recentRun.getStartTimeUtc()); data.appendToSummary(", last run "+start+" ago"); } - if (groovyTruth(getNextScheduled())) { - Duration untilNext = Duration.millis(getNextScheduled().getDelay(TimeUnit.MILLISECONDS)); + ScheduledFuture<?> nextScheduled = getNextScheduled(); + if (nextScheduled!=null) { + if (nextScheduled.isDone() || nextScheduled.isCancelled()) { + data.appendToSummary(", not scheduled to run again"); + } + Duration untilNext = Duration.millis(nextScheduled.getDelay(TimeUnit.MILLISECONDS)); if (untilNext.isPositive()) data.appendToSummary(", next in "+untilNext); else data.appendToSummary(", next imminent"); + } else { + data.appendToSummary(", nothing scheduled"); } } }
