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 1fce240d6aac CAMEL-24402: Lazy init threadNamePattern (#25532)
1fce240d6aac is described below

commit 1fce240d6aac64d7b5bd3a8308865bbe5189909c
Author: Benjamin Graf <[email protected]>
AuthorDate: Fri Aug 28 14:06:54 2026 +0200

    CAMEL-24402: Lazy init threadNamePattern (#25532)
---
 .../apache/camel/impl/engine/BaseExecutorServiceManager.java   | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/BaseExecutorServiceManager.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/BaseExecutorServiceManager.java
index 3d92f70f8707..ccaf54b31276 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/BaseExecutorServiceManager.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/BaseExecutorServiceManager.java
@@ -162,7 +162,7 @@ public class BaseExecutorServiceManager extends 
ServiceSupport implements Execut
 
     @Override
     public String resolveThreadName(String name) {
-        return ThreadHelper.resolveThreadName(threadNamePattern, name);
+        return ThreadHelper.resolveThreadName(resolveThreadNamePattern(), 
name);
     }
 
     @Override
@@ -445,7 +445,7 @@ public class BaseExecutorServiceManager extends 
ServiceSupport implements Execut
 
         if (threadNamePattern == null) {
             // set default name pattern which includes the camel context name
-            threadNamePattern = "Camel (" + camelContext.getName() + ") thread 
##counter# - #name#";
+            threadNamePattern = "Camel (#camelId#) thread ##counter# - #name#";
         }
 
         // discover thread pool factory
@@ -610,8 +610,12 @@ public class BaseExecutorServiceManager extends 
ServiceSupport implements Execut
         onNewExecutorService(executorService);
     }
 
+    protected String resolveThreadNamePattern() {
+        return StringHelper.replaceFirst(threadNamePattern, "#camelId#", 
camelContext.getName());
+    }
+
     protected ThreadFactory createThreadFactory(Object source, String name, 
boolean daemon) {
-        ThreadFactory factory = new CamelThreadFactory(threadNamePattern, 
name, daemon);
+        ThreadFactory factory = new 
CamelThreadFactory(resolveThreadNamePattern(), name, daemon);
         for (ThreadFactoryListener listener : threadFactoryListeners) {
             factory = listener.onNewThreadFactory(source, factory);
         }

Reply via email to