This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch rc
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 606d52fa236dc945d71b873a1a293616fa3c48a4
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Dec 16 12:48:12 2023 +0100

    CAMEL-20242: camel-core: RouteController health check to be DOWN during 
starting routes. Supervising route controller option to be DOWN during 
restarting phase.
---
 .../impl/engine/DefaultSupervisingRouteController.java  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
index 8b943f34c20..44b3b6cc6a0 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultSupervisingRouteController.java
@@ -249,7 +249,19 @@ public class DefaultSupervisingRouteController extends 
DefaultRouteController im
 
     @Override
     public boolean isStartingRoutes() {
-        return startingRoutes;
+        boolean answer = startingRoutes;
+
+        // if we have started the routes first time, but some failed and are 
scheduled for restart
+        // then we may report as still starting routes if we should be 
unhealthy on restarting
+        if (!answer && isUnhealthyOnRestarting()) {
+            // mark as still starting routes if we have routes to restart
+            answer = !routeManager.routes.isEmpty();
+        }
+        if (!answer && isUnhealthyOnExhausted()) {
+            // mark as still starting routes if we have exhausted routes that 
should be unhealthy
+            answer = !routeManager.exhausted.isEmpty();
+        }
+        return answer;
     }
 
     @Override
@@ -621,7 +633,8 @@ public class DefaultSupervisingRouteController extends 
DefaultRouteController im
 
                             if (!getCamelContext().isRunAllowed()) {
                                 // Camel is shutting down so do not attempt to 
start route
-                                logger.info("Restarting route: {} attempt: {} 
is cancelled due CamelContext is shutting down", r.getId(), attempt);
+                                logger.info("Restarting route: {} attempt: {} 
is cancelled due CamelContext is shutting down",
+                                        r.getId(), attempt);
                                 return true;
                             }
 

Reply via email to