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

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

commit 28d12d815831641a946b19a30e6aadaefd8c5fa4
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jul 14 14:41:04 2025 +0200

    CAMEL-22214: camel-groovy - Allow to pre-load groovy source files for 
shared functions and DTOs
---
 .../camel/language/groovy/DefaultGroovyScriptCompiler.java  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/DefaultGroovyScriptCompiler.java
 
b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/DefaultGroovyScriptCompiler.java
index 51d09ad2aee..5dffbc130e8 100644
--- 
a/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/DefaultGroovyScriptCompiler.java
+++ 
b/components/camel-groovy/src/main/java/org/apache/camel/language/groovy/DefaultGroovyScriptCompiler.java
@@ -44,7 +44,7 @@ public class DefaultGroovyScriptCompiler extends 
ServiceSupport
 
     private static final Logger LOG = 
LoggerFactory.getLogger(DefaultGroovyScriptCompiler.class);
 
-    private long elapsed;
+    private long taken;
     private GroovyScriptClassLoader classLoader;
     private CamelContext camelContext;
     private String scriptPattern;
@@ -61,7 +61,7 @@ public class DefaultGroovyScriptCompiler extends 
ServiceSupport
 
     @ManagedAttribute(description = "Total Groovy compilation time in millis")
     public long getCompileTime() {
-        return elapsed;
+        return taken;
     }
 
     @ManagedAttribute(description = "Number of Groovy sources that has been 
compiled")
@@ -102,7 +102,7 @@ public class DefaultGroovyScriptCompiler extends 
ServiceSupport
         if (scriptPattern != null) {
             StopWatch watch = new StopWatch();
 
-            LOG.info("Pre-compiling Groovy source from: {}", scriptPattern);
+            LOG.info("Pre-compiling Groovy sources from: {}", scriptPattern);
 
             ClassLoader cl = camelContext.getApplicationContextClassLoader();
             if (cl == null) {
@@ -152,13 +152,18 @@ public class DefaultGroovyScriptCompiler extends 
ServiceSupport
                     classLoader.addClass(clazz.getName(), clazz);
                 }
             }
-            elapsed = watch.taken();
+            taken += watch.taken();
         }
     }
 
     @Override
     protected void doStop() throws Exception {
         super.doStop();
+
+        if (classLoader.size() > 0) {
+            LOG.info("Pre-compiled {} Groovy sources in {} millis", 
classLoader.size(), taken);
+        }
+
         IOHelper.close(classLoader);
     }
 }

Reply via email to