You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/01/20 11:36:04 UTC

[camel] branch main updated: CAMEL-17519: Expose MainSupprt.internalBeforeStart so that it can be overridden

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8c64bb7  CAMEL-17519: Expose MainSupprt.internalBeforeStart so that it can be overridden
8c64bb7 is described below

commit 8c64bb76d8fecefb8f0b21d568979cb963d07072
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Jan 20 10:02:55 2022 +0000

    CAMEL-17519: Expose MainSupprt.internalBeforeStart so that it can be overridden
---
 .../main/java/org/apache/camel/main/MainSupport.java | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index 1b925d8..824bfec 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -103,7 +103,10 @@ public abstract class MainSupport extends BaseMainSupport {
         }
     }
 
-    private void internalBeforeStart() {
+    /**
+     * Tasks to run before start() is called.
+     */
+    protected void internalBeforeStart() {
         // used while waiting to be done
         durationMaxIdleSeconds = mainConfigurationProperties.getDurationMaxIdleSeconds();
         durationMaxMessages = mainConfigurationProperties.getDurationMaxMessages();
@@ -112,10 +115,7 @@ public abstract class MainSupport extends BaseMainSupport {
         durationMaxAction = mainConfigurationProperties.getDurationMaxAction();
 
         // register main as bootstrap
-        CamelContext context = getCamelContext();
-        if (context != null) {
-            context.adapt(ExtendedCamelContext.class).addBootstrap(new MainBootstrapCloseable(this));
-        }
+        registerMainBootstrap();
     }
 
     /**
@@ -166,6 +166,16 @@ public abstract class MainSupport extends BaseMainSupport {
         return this::completed;
     }
 
+    /**
+     * Registers {@link MainBootstrapCloseable} with the CamelContext.
+     */
+    protected void registerMainBootstrap() {
+        CamelContext context = getCamelContext();
+        if (context != null) {
+            context.adapt(ExtendedCamelContext.class).addBootstrap(new MainBootstrapCloseable(this));
+        }
+    }
+
     @Deprecated
     public int getDuration() {
         return mainConfigurationProperties.getDurationMaxSeconds();