You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2024/01/05 07:50:21 UTC

(camel) branch main updated (d441ff5dcfe -> ab4a4b607cb)

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

orpiske pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from d441ff5dcfe Regen for commit cf9a2cab956af5e9aac204e5e0559c25ee6ed082 (#12671)
     new 87a8fa44349 (chores) camel-core: use a lambda for better readability in AbstractCamelContext
     new ab4a4b607cb (chores) camel-core: minor code cleanup

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      | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)


(camel) 01/02: (chores) camel-core: use a lambda for better readability in AbstractCamelContext

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 87a8fa4434924e58c0f39c4eba92bf5a63c10d65
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Jan 4 16:17:10 2024 +0100

    (chores) camel-core: use a lambda for better readability in AbstractCamelContext
---
 .../main/java/org/apache/camel/impl/engine/AbstractCamelContext.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 4e8c9f31c19..cbe379d9e05 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
@@ -221,7 +221,7 @@ public abstract class AbstractCamelContext extends BaseService
     private final InternalRouteStartupManager internalRouteStartupManager = new InternalRouteStartupManager();
     private final List<RouteStartupOrder> routeStartupOrder = new ArrayList<>();
     private final StopWatch stopWatch = new StopWatch(false);
-    private final ThreadLocal<Set<String>> componentsInCreation = ThreadLocal.withInitial(() -> new HashSet<>());
+    private final ThreadLocal<Set<String>> componentsInCreation = ThreadLocal.withInitial(HashSet::new);
     private VetoCamelContextStartException vetoed;
     private String managementName;
     private ClassLoader applicationContextClassLoader;


(camel) 02/02: (chores) camel-core: minor code cleanup

Posted by or...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ab4a4b607cba08d5f1b6182bf61db74cbf8b29ac
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Jan 4 16:22:05 2024 +0100

    (chores) camel-core: minor code cleanup
---
 .../apache/camel/impl/engine/AbstractCamelContext.java | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 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 cbe379d9e05..7081ec8cb80 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
@@ -606,14 +606,18 @@ public abstract class AbstractCamelContext extends BaseService
         Component component = getComponent(name);
         if (componentType.isInstance(component)) {
             return componentType.cast(component);
+        }
+
+        final String message = invalidComponentMessage(name, componentType, component);
+        throw new IllegalArgumentException(message);
+    }
+
+    private static <
+            T extends Component> String invalidComponentMessage(String name, Class<T> componentType, Component component) {
+        if (component == null) {
+            return "Did not find component given by the name: " + name;
         } else {
-            String message;
-            if (component == null) {
-                message = "Did not find component given by the name: " + name;
-            } else {
-                message = "Found component of type: " + component.getClass() + " instead of expected: " + componentType;
-            }
-            throw new IllegalArgumentException(message);
+            return "Found component of type: " + component.getClass() + " instead of expected: " + componentType;
         }
     }