You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/10/12 20:57:24 UTC
(camel) branch main updated (8ff30af1ac3 -> 8f8ff424f1b)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from 8ff30af1ac3 Polished
new 6423dbf4ad0 Remove code not in use
new 8f8ff424f1b CAMEL-21338: camel-core - Add boot startup time in INFO logging so it show the total time incl boot camel-jbang/camel-main/camel-spring-boot that may take some time also.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../camel/impl/engine/AbstractCamelContext.java | 2 +-
.../org/apache/camel/main/BaseMainSupport.java | 54 +++++++++-------------
.../src/main/java/org/apache/camel/main/Main.java | 2 -
.../java/org/apache/camel/main/MainSupport.java | 2 -
4 files changed, 22 insertions(+), 38 deletions(-)
(camel) 01/02: Remove code not in use
Posted by da...@apache.org.
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 6423dbf4ad0fe7c5270ca5944412be3b0f0e0698
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Oct 12 18:26:39 2024 +0200
Remove code not in use
---
.../org/apache/camel/main/BaseMainSupport.java | 24 ++--------------------
1 file changed, 2 insertions(+), 22 deletions(-)
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index cb7ec3a4f78..161ca88c86f 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -71,14 +71,12 @@ import org.apache.camel.spi.CamelEvent;
import org.apache.camel.spi.CamelMetricsService;
import org.apache.camel.spi.CamelTracingService;
import org.apache.camel.spi.CompileStrategy;
-import org.apache.camel.spi.ContextReloadStrategy;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.Debugger;
import org.apache.camel.spi.DebuggerFactory;
import org.apache.camel.spi.Language;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.PeriodTaskScheduler;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.spi.Registry;
import org.apache.camel.spi.RouteTemplateParameterSource;
@@ -86,7 +84,6 @@ import org.apache.camel.spi.RoutesLoader;
import org.apache.camel.spi.StartupStepRecorder;
import org.apache.camel.spi.SupervisingRouteController;
import org.apache.camel.support.CamelContextHelper;
-import org.apache.camel.support.DefaultContextReloadStrategy;
import org.apache.camel.support.LifecycleStrategySupport;
import org.apache.camel.support.PluginHelper;
import org.apache.camel.support.PropertyBindingSupport;
@@ -110,7 +107,6 @@ import org.apache.camel.util.OrderedLocationProperties;
import org.apache.camel.util.OrderedProperties;
import org.apache.camel.util.SensitiveUtils;
import org.apache.camel.util.StringHelper;
-import org.apache.camel.util.TimeUtils;
import org.apache.camel.vault.VaultConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -499,24 +495,6 @@ public abstract class BaseMainSupport extends BaseService {
protected void configureLifecycle(CamelContext camelContext) throws Exception {
}
- private void scheduleRefresh(CamelContext camelContext, String key, long period) throws Exception {
- final Optional<Runnable> task = PluginHelper.getPeriodTaskResolver(camelContext)
- .newInstance(key, Runnable.class);
- if (task.isPresent()) {
- Runnable r = task.get();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
- }
- if (camelContext.hasService(ContextReloadStrategy.class) == null) {
- // refresh is enabled then we need to automatically enable context-reload as well
- ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
- camelContext.addService(reloader);
- }
- PeriodTaskScheduler scheduler = PluginHelper.getPeriodTaskScheduler(camelContext);
- scheduler.schedulePeriodTask(r, period);
- }
- }
-
protected void autoconfigure(CamelContext camelContext) throws Exception {
// gathers the properties (key=value) that was auto-configured
final OrderedLocationProperties autoConfiguredProperties = new OrderedLocationProperties();
@@ -796,9 +774,11 @@ public abstract class BaseMainSupport extends BaseService {
postProcessCamelRegistry(camelContext, mainConfigurationProperties);
// allow doing custom configuration before camel is started
+ step = recorder.beginStep(BaseMainSupport.class, "afterConfigure", "MainListener");
for (MainListener listener : listeners) {
listener.afterConfigure(this);
}
+ recorder.endStep(step);
// we want to log the property placeholder summary after routes has been started,
// but before camel context logs that it has been started, so we need to use an event listener
(camel) 02/02: CAMEL-21338: camel-core - Add boot startup time in INFO logging so it show the total time incl boot camel-jbang/camel-main/camel-spring-boot that may take some time also.
Posted by da...@apache.org.
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 8f8ff424f1b2de2eef97985136253ebf353fd09a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Oct 12 22:55:38 2024 +0200
CAMEL-21338: camel-core - Add boot startup time in INFO logging so it show the total time incl boot camel-jbang/camel-main/camel-spring-boot that may take some time also.
---
.../camel/impl/engine/AbstractCamelContext.java | 2 +-
.../org/apache/camel/main/BaseMainSupport.java | 34 +++++++++++++---------
.../src/main/java/org/apache/camel/main/Main.java | 2 --
.../java/org/apache/camel/main/MainSupport.java | 2 --
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index a874ef3a18b..4bca692a410 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -2749,7 +2749,7 @@ public abstract class AbstractCamelContext extends BaseService
}
}
String msg = String.format("Apache Camel %s (%s) started in %s (build:%s init:%s start:%s", getVersion(),
- camelContextExtension.getName(), total, built, init, start);
+ camelContextExtension.getName(), total, built, init, start);
if (boot != null) {
msg += " boot:" + boot;
}
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index 161ca88c86f..0f06523176f 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -739,19 +739,25 @@ public abstract class BaseMainSupport extends BaseService {
// ensure camel context is build
camelContext.build();
- for (MainListener listener : listeners) {
- listener.beforeInitialize(this);
- }
-
- // allow doing custom configuration before camel is started
- for (MainListener listener : listeners) {
- listener.beforeConfigure(this);
- }
-
// we want to capture startup events for import tasks during main bootstrap
StartupStepRecorder recorder = camelContext.getCamelContextExtension().getStartupStepRecorder();
StartupStep step;
+ if (!listeners.isEmpty()) {
+ step = recorder.beginStep(BaseMainSupport.class, "beforeInitialize", "MainListener");
+ for (MainListener listener : listeners) {
+ listener.beforeInitialize(this);
+ }
+ recorder.endStep(step);
+
+ // allow doing custom configuration before camel is started
+ step = recorder.beginStep(BaseMainSupport.class, "beforeConfigure", "MainListener");
+ for (MainListener listener : listeners) {
+ listener.beforeConfigure(this);
+ }
+ recorder.endStep(step);
+ }
+
if (standalone) {
step = recorder.beginStep(BaseMainSupport.class, "autoconfigure", "Auto Configure");
autoconfigure(camelContext);
@@ -774,11 +780,13 @@ public abstract class BaseMainSupport extends BaseService {
postProcessCamelRegistry(camelContext, mainConfigurationProperties);
// allow doing custom configuration before camel is started
- step = recorder.beginStep(BaseMainSupport.class, "afterConfigure", "MainListener");
- for (MainListener listener : listeners) {
- listener.afterConfigure(this);
+ if (!listeners.isEmpty()) {
+ step = recorder.beginStep(BaseMainSupport.class, "afterConfigure", "MainListener");
+ for (MainListener listener : listeners) {
+ listener.afterConfigure(this);
+ }
+ recorder.endStep(step);
}
- recorder.endStep(step);
// we want to log the property placeholder summary after routes has been started,
// but before camel context logs that it has been started, so we need to use an event listener
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/Main.java b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
index bdab0232182..fbdf88d436a 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/Main.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
@@ -20,9 +20,7 @@ import java.util.Map;
import org.apache.camel.CamelConfiguration;
import org.apache.camel.CamelContext;
-import org.apache.camel.ContextEvents;
import org.apache.camel.ProducerTemplate;
-import org.apache.camel.clock.EventClock;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.Registry;
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 fd508d6c75b..ffb89845d66 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
@@ -24,11 +24,9 @@ import org.apache.camel.CamelContext;
import org.apache.camel.ContextEvents;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.clock.Clock;
-import org.apache.camel.clock.ContextClock;
import org.apache.camel.spi.EventNotifier;
import org.apache.camel.support.ResetableClock;
import org.apache.camel.support.service.ServiceHelper;
-import org.apache.camel.util.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;