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 2021/02/06 16:47:45 UTC

[camel] 04/04: Polished

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

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

commit eb415246efb97e569a7b46ac41a77bc0e0de8ebf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Feb 6 17:46:52 2021 +0100

    Polished
---
 .../java/org/apache/camel/main/DefaultRoutesCollector.java   | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
index 198697f..648bd5c 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExtendedCamelContext;
@@ -127,7 +126,6 @@ public class DefaultRoutesCollector implements RoutesCollector {
         }
 
         StopWatch watch = new StopWatch();
-        AtomicInteger count = new AtomicInteger();
 
         if (ObjectHelper.equal("false", includePattern)) {
             return answer;
@@ -147,18 +145,16 @@ public class DefaultRoutesCollector implements RoutesCollector {
                     }
 
                     log.debug("Found {} route builder from location: {}", builders.size(), include);
-                    for (RoutesBuilder builder : builders) {
-                        answer.add(builder);
-                        count.incrementAndGet();
-                    }
+                    answer.addAll(builders);
                 }
             } catch (FileNotFoundException e) {
                 log.debug("No RoutesBuilder found in {}. Skipping detection.", include);
             } catch (Exception e) {
                 throw RuntimeCamelException.wrapRuntimeException(e);
             }
-            if (count.get() > 0) {
-                log.info("Loaded {} ({} millis) additional RoutesBuilder from: {}, pattern: {}", count, watch.taken(), include,
+            if (answer.size() > 0) {
+                log.info("Loaded {} ({} millis) additional RoutesBuilder from: {}, pattern: {}", answer.size(), watch.taken(),
+                        include,
                         includePattern);
             } else {
                 log.debug("No additional RoutesBuilder discovered from: {}", includePattern);