This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch CAMEL-17519 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 08ea8ff0d0203aeec546a2d256c3bb0a2529b74e Author: James Netherton <jamesnether...@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();