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 2023/04/04 11:42:29 UTC

[camel] branch main updated: CAMEL-19240: camel-core - JVM uptime vs camel uptime

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


The following commit(s) were added to refs/heads/main by this push:
     new 77959f2da40 CAMEL-19240: camel-core - JVM uptime vs camel uptime
77959f2da40 is described below

commit 77959f2da40a3bae27c680fe43fced8573d2ee71
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Apr 4 13:41:56 2023 +0200

    CAMEL-19240: camel-core - JVM uptime vs camel uptime
---
 .../camel/impl/engine/AbstractCamelContext.java    | 37 +++-------------------
 .../src/main/java/org/apache/camel/main/Main.java  |  1 -
 .../java/org/apache/camel/main/KameletMain.java    |  1 -
 3 files changed, 4 insertions(+), 35 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 9f056205b27..2aa03445e97 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
@@ -290,7 +290,6 @@ public abstract class AbstractCamelContext extends BaseService
     private long startDate;
     private SSLContextParameters sslContextParameters;
     private StartupSummaryLevel startupSummaryLevel = StartupSummaryLevel.Default;
-    private boolean logJvmUptime;
 
     /**
      * Creates the {@link CamelContext} using {@link org.apache.camel.support.DefaultRegistry} as registry.
@@ -2625,18 +2624,8 @@ public abstract class AbstractCamelContext extends BaseService
             String start = TimeUtils.printDuration(taken, true);
             String init = TimeUtils.printDuration(initTaken, true);
             String built = TimeUtils.printDuration(buildTaken, true);
-            String jvm = logJvmUptime ? getJvmUptime() : null;
-            if (jvm != null) {
-                LOG.info("Apache Camel {} ({}) started in {} (build:{} init:{} start:{} JVM-uptime:{})", getVersion(),
-                        camelContextExtension.getName(), total, built,
-                        init, start, jvm);
-            } else {
-                LOG.info("Apache Camel {} ({}) started in {} (build:{} init:{} start:{})", getVersion(),
-                        camelContextExtension.getName(), total,
-                        built,
-                        init,
-                        start);
-            }
+            LOG.info("Apache Camel {} ({}) started in {} (build:{} init:{} start:{})", getVersion(),
+                    camelContextExtension.getName(), total, built, init, start);
         }
     }
 
@@ -2975,15 +2964,8 @@ public abstract class AbstractCamelContext extends BaseService
         if (startupSummaryLevel != StartupSummaryLevel.Off) {
             if (LOG.isInfoEnabled()) {
                 String taken = TimeUtils.printDuration(stopWatch.taken(), true);
-                String jvm = logJvmUptime ? getJvmUptime() : null;
-                if (jvm != null) {
-                    LOG.info("Apache Camel {} ({}) shutdown in {} (uptime:{} JVM-uptime:{})", getVersion(),
-                            camelContextExtension.getName(), taken,
-                            getUptime(), jvm);
-                } else {
-                    LOG.info("Apache Camel {} ({}) shutdown in {} (uptime:{})", getVersion(), camelContextExtension.getName(),
-                            taken, getUptime());
-                }
+                LOG.info("Apache Camel {} ({}) shutdown in {} (uptime:{})", getVersion(), camelContextExtension.getName(),
+                        taken, getUptime());
             }
         }
 
@@ -3922,17 +3904,6 @@ public abstract class AbstractCamelContext extends BaseService
         this.startupSummaryLevel = startupSummaryLevel;
     }
 
-    public boolean isLogJvmUptime() {
-        return logJvmUptime;
-    }
-
-    /**
-     * Whether to log the JVM uptime on startup and shutdown
-     */
-    public void setLogJvmUptime(boolean logJvmUptime) {
-        this.logJvmUptime = logJvmUptime;
-    }
-
     protected Map<String, RouteService> getRouteServices() {
         return routeServices;
     }
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 652fbcf945e..c2465a476d7 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
@@ -169,7 +169,6 @@ public class Main extends MainCommandLineSupport {
     protected CamelContext createCamelContext() {
         // do not build/init camel context yet
         DefaultCamelContext answer = new DefaultCamelContext(false);
-        answer.setLogJvmUptime(true); // we run in standalone mode so lets show JVM uptime
         answer.getCamelContextExtension().setRegistry(registry);
         if (mainClass != null) {
             answer.getGlobalOptions().put("CamelMainClass", mainClass.getName());
diff --git a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 8f49f4cbf1c..07b9b9a3212 100644
--- a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -308,7 +308,6 @@ public class KameletMain extends MainCommandLineSupport {
     protected CamelContext createCamelContext() {
         // do not build/init camel context yet
         DefaultCamelContext answer = new DefaultCamelContext(false);
-        answer.setLogJvmUptime(true);
         if (download) {
             ClassLoader dynamicCL = createApplicationContextClassLoader();
             answer.setApplicationContextClassLoader(dynamicCL);