This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 39c294e5ab2a576645fee75e47f9bc9f5dcd1d30 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Jun 27 08:28:14 2022 +0200 Fixed potential NPE in shutdown strategy --- .../org/apache/camel/impl/engine/DefaultShutdownStrategy.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultShutdownStrategy.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultShutdownStrategy.java index 0289f64077e..0c595bc0516 100644 --- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultShutdownStrategy.java +++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultShutdownStrategy.java @@ -230,7 +230,9 @@ public class DefaultShutdownStrategy extends ServiceSupport implements ShutdownS timeoutOccurred.set(true); // timeout then cancel the task - currentShutdownTaskFuture.cancel(true); + if (currentShutdownTaskFuture != null) { + currentShutdownTaskFuture.cancel(true); + } // signal we are forcing shutdown now, since timeout occurred this.forceShutdown = forceShutdown; @@ -372,6 +374,11 @@ public class DefaultShutdownStrategy extends ServiceSupport implements ShutdownS this.camelContext = camelContext; } + /** + * Future for the current shutdown task, when a task is in progress. + * <p/> + * Important: This API is only for advanced use-cases. + */ public Future<?> getCurrentShutdownTaskFuture() { return currentShutdownTaskFuture; }
