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 2023/06/09 14:23:19 UTC

[camel] branch main updated (a0cfe7e7918 -> ee5992f2f33)

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 a0cfe7e7918 incremental-build - Reduce timeout
     new 2a008aab585 (chores) core: downgrade fields to local variables when possible
     new ee5992f2f33 (chores) core: removed unused code

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/language/csimple/CSimpleHelper.java      |  2 +-
 .../org/apache/camel/support/GroupIterator.java    | 22 +---------------------
 .../camel/support/builder/ExpressionBuilder.java   | 14 +++++---------
 .../camel/support/cache/EventNotifierCallback.java |  5 ++---
 4 files changed, 9 insertions(+), 34 deletions(-)


[camel] 01/02: (chores) core: downgrade fields to local variables when possible

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 2a008aab585ab87e4b54059ef99e6fd9a41db1f6
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 9 14:27:07 2023 +0200

    (chores) core: downgrade fields to local variables when possible
---
 .../org/apache/camel/support/builder/ExpressionBuilder.java  | 12 ++++--------
 .../apache/camel/support/cache/EventNotifierCallback.java    |  5 ++---
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
index b66df0abf23..05b4ddbe065 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
@@ -1834,7 +1834,6 @@ public class ExpressionBuilder {
         if (LanguageSupport.hasSimpleFunction(expression)) {
             return new ExpressionAdapter() {
                 private Expression exp;
-                private Language language;
 
                 @Override
                 public Object evaluate(Exchange exchange) {
@@ -1843,7 +1842,7 @@ public class ExpressionBuilder {
 
                 @Override
                 public void init(CamelContext context) {
-                    this.language = context.resolveLanguage("simple");
+                    final Language language = context.resolveLanguage("simple");
                     this.exp = language.createExpression(expression);
                     this.exp.init(context);
                 }
@@ -1861,7 +1860,6 @@ public class ExpressionBuilder {
     public static Expression beanExpression(final String expression) {
         return new ExpressionAdapter() {
             private Expression exp;
-            private Language language;
 
             @Override
             public Object evaluate(Exchange exchange) {
@@ -1872,7 +1870,7 @@ public class ExpressionBuilder {
 
             @Override
             public void init(CamelContext context) {
-                this.language = context.resolveLanguage("bean");
+                final Language language = context.resolveLanguage("bean");
                 this.exp = language.createExpression(expression);
                 this.exp.init(context);
             }
@@ -1886,7 +1884,6 @@ public class ExpressionBuilder {
 
     public static Expression beanExpression(final Object bean, final String method) {
         return new ExpressionAdapter() {
-            private Language language;
             private Expression exp;
 
             @Override
@@ -1896,7 +1893,7 @@ public class ExpressionBuilder {
 
             @Override
             public void init(CamelContext context) {
-                this.language = context.resolveLanguage("bean");
+                final Language language = context.resolveLanguage("bean");
                 this.exp = language.createExpression(null, new Object[]{bean, method});
                 this.exp.init(context);
             }
@@ -2020,7 +2017,6 @@ public class ExpressionBuilder {
     public static Expression tokenizeXMLAwareExpression(String headerName, String path, char mode, int group, Namespaces namespaces) {
         StringHelper.notEmpty(path, "path");
         return new ExpressionAdapter() {
-            private Language language;
             private Expression exp;
 
             @Override
@@ -2030,7 +2026,7 @@ public class ExpressionBuilder {
 
             @Override
             public void init(CamelContext context) {
-                this.language = context.resolveLanguage("xtokenize");
+                final Language language = context.resolveLanguage("xtokenize");
                 this.exp = language.createExpression(path, new Object[]{headerName, mode, group, namespaces});
                 this.exp.init(context);
             }
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/cache/EventNotifierCallback.java b/core/camel-support/src/main/java/org/apache/camel/support/cache/EventNotifierCallback.java
index 123d6d2681d..4d6f9eb312b 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/cache/EventNotifierCallback.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/cache/EventNotifierCallback.java
@@ -30,15 +30,14 @@ class EventNotifierCallback implements AsyncCallback {
     private final StopWatch watch;
     private final Exchange exchange;
     private final Endpoint endpoint;
-    private final boolean sending;
 
     public EventNotifierCallback(AsyncCallback originalCallback, Exchange exchange,
                                  Endpoint endpoint) {
         this.originalCallback = originalCallback;
         this.exchange = exchange;
         this.endpoint = endpoint;
-        this.sending = EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
-        if (this.sending) {
+        final boolean sending = EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
+        if (sending) {
             this.watch = new StopWatch();
         } else {
             this.watch = null;


[camel] 02/02: (chores) core: removed unused code

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 ee5992f2f33116134ead28a6d3d0396ac814491f
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 9 14:30:22 2023 +0200

    (chores) core: removed unused code
---
 .../camel/language/csimple/CSimpleHelper.java      |  2 +-
 .../org/apache/camel/support/GroupIterator.java    | 22 +---------------------
 .../camel/support/builder/ExpressionBuilder.java   |  2 +-
 3 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
index 73b96c166a8..de7fc87740f 100644
--- a/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
+++ b/core/camel-core-languages/src/main/java/org/apache/camel/language/csimple/CSimpleHelper.java
@@ -470,7 +470,7 @@ public final class CSimpleHelper {
     public static GroupIterator collate(Exchange exchange, Object group) {
         int num = exchange.getContext().getTypeConverter().tryConvertTo(int.class, exchange, group);
         Iterator<?> it = org.apache.camel.support.ObjectHelper.createIterator(exchange.getMessage().getBody());
-        return new GroupIterator(exchange, it, num);
+        return new GroupIterator(it, num);
     }
 
     public static String messageHistory(Exchange exchange, boolean detailed) {
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/GroupIterator.java b/core/camel-support/src/main/java/org/apache/camel/support/GroupIterator.java
index d905e3a5466..e408008b80e 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/GroupIterator.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/GroupIterator.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.IOHelper;
@@ -37,42 +36,23 @@ import org.apache.camel.util.IOHelper;
  */
 public final class GroupIterator implements Iterator<Object>, Closeable {
 
-    private final CamelContext camelContext;
-    private final Exchange exchange;
     private final Iterator<?> it;
     private final int group;
-    private final boolean skipFirst;
     private boolean closed;
 
     /**
      * Creates a new group iterator
      *
-     * @param  exchange                 the exchange used to create this group iterator
      * @param  it                       the iterator to group
      * @param  group                    number of parts to group together
      * @throws IllegalArgumentException is thrown if group is not a positive number
      */
-    public GroupIterator(Exchange exchange, Iterator<?> it, int group) {
-        this(exchange, it, group, false);
-    }
-
-    /**
-     * Creates a new group iterator
-     *
-     * @param  exchange                 the exchange used to create this group iterator
-     * @param  it                       the iterator to group
-     * @param  group                    number of parts to group together
-     * @throws IllegalArgumentException is thrown if group is not a positive number
-     */
-    public GroupIterator(Exchange exchange, Iterator<?> it, int group, boolean skipFirst) {
-        this.exchange = exchange;
-        this.camelContext = exchange.getContext();
+    public GroupIterator(Iterator<?> it, int group) {
         this.it = it;
         this.group = group;
         if (group <= 0) {
             throw new IllegalArgumentException("Group must be a positive number, was: " + group);
         }
-        this.skipFirst = skipFirst;
     }
 
     @Override
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
index 05b4ddbe065..73455f148f1 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
@@ -1418,7 +1418,7 @@ public class ExpressionBuilder {
                 if (token != null) {
                     return new GroupTokenIterator(exchange, it, token, parts, skipFirst);
                 } else {
-                    return new GroupIterator(exchange, it, parts, skipFirst);
+                    return new GroupIterator(it, parts);
                 }
             }