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/04/07 16:26:52 UTC

[camel] branch master updated (bde9f1a -> 0506369)

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

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


    from bde9f1a  Camel-AWS2-SNS: Check if useDefaultCredentialsProvider is present or not
     new 5485d34  CAMEL-16462: camel-core - Optimize RecipientList EIP to reduce object allocations.
     new 0506369  CAMEL-16462: camel-core - Optimize Splitter EIP to reduce object allocations.

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:
 .../apache/camel/processor/MulticastProcessor.java | 34 +++++++++++-----------
 .../camel/processor/RecipientListProcessor.java    |  2 +-
 .../java/org/apache/camel/processor/Splitter.java  |  6 ++--
 3 files changed, 21 insertions(+), 21 deletions(-)

[camel] 01/02: CAMEL-16462: camel-core - Optimize RecipientList EIP to reduce object allocations.

Posted by da...@apache.org.
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 5485d343755a30cf5e10eb9f5165a682f9c94278
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Apr 7 18:11:23 2021 +0200

    CAMEL-16462: camel-core - Optimize RecipientList EIP to reduce object allocations.
---
 .../apache/camel/processor/MulticastProcessor.java | 34 +++++++++++-----------
 .../camel/processor/RecipientListProcessor.java    |  2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
index cf76c89..39e59a7 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/MulticastProcessor.java
@@ -215,8 +215,8 @@ public class MulticastProcessor extends AsyncProcessorSupport
         this.shareUnitOfWork = shareUnitOfWork;
         this.parallelAggregate = parallelAggregate;
         this.stopOnAggregateException = stopOnAggregateException;
-        if (this instanceof Splitter || this instanceof RecipientListProcessor) {
-            // not supported for splitter/recipient-list
+        if (this instanceof Splitter) {
+            // not supported for splitter
             this.processorExchangeFactory = null;
         } else {
             this.processorExchangeFactory = camelContext.adapt(ExtendedCamelContext.class)
@@ -788,21 +788,6 @@ public class MulticastProcessor extends AsyncProcessorSupport
             Exchange original, Exchange subExchange, final Iterable<ProcessorExchangePair> pairs,
             AsyncCallback callback, boolean doneSync, boolean forceExhaust) {
 
-        if (processorExchangeFactory != null && pairs != null) {
-            // the exchanges on the pairs was created with a factory, so they should be released
-            try {
-                for (ProcessorExchangePair pair : pairs) {
-                    processorExchangeFactory.release(pair.getExchange());
-                }
-            } catch (Throwable e) {
-                LOG.warn("Error releasing exchange due to " + e.getMessage() + ". This exception is ignored.", e);
-            }
-        }
-        // we are done so close the pairs iterator
-        if (pairs instanceof Closeable) {
-            IOHelper.close((Closeable) pairs, "pairs", LOG);
-        }
-
         AggregationStrategy strategy = getAggregationStrategy(subExchange);
         // invoke the on completion callback
         if (strategy != null) {
@@ -835,6 +820,21 @@ public class MulticastProcessor extends AsyncProcessorSupport
             }
         }
 
+        if (processorExchangeFactory != null && pairs != null) {
+            // the exchanges on the pairs was created with a factory, so they should be released
+            try {
+                for (ProcessorExchangePair pair : pairs) {
+                    processorExchangeFactory.release(pair.getExchange());
+                }
+            } catch (Throwable e) {
+                LOG.warn("Error releasing exchange due to " + e.getMessage() + ". This exception is ignored.", e);
+            }
+        }
+        // we are done so close the pairs iterator
+        if (pairs instanceof Closeable) {
+            IOHelper.close((Closeable) pairs, "pairs", LOG);
+        }
+
         // .. and then if there was an exception we need to configure the redelivery exhaust
         // for example the noErrorHandler will not cause redelivery exhaust so if this error
         // handled has been in use, then the exhaust would be false (if not forced)
diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
index 720c937..0cba21d 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/RecipientListProcessor.java
@@ -288,7 +288,7 @@ public class RecipientListProcessor extends MulticastProcessor {
             int index, Endpoint endpoint, Producer producer,
             Exchange exchange, ExchangePattern pattern, boolean prototypeEndpoint) {
         // copy exchange, and do not share the unit of work
-        Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false);
+        Exchange copy = processorExchangeFactory.createCorrelatedCopy(exchange, false);
 
         // if we share unit of work, we need to prepare the child exchange
         if (isShareUnitOfWork()) {

[camel] 02/02: CAMEL-16462: camel-core - Optimize Splitter EIP to reduce object allocations.

Posted by da...@apache.org.
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 0506369355552c2736e0305efd9d3395485d4e35
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Apr 7 18:26:17 2021 +0200

    CAMEL-16462: camel-core - Optimize Splitter EIP to reduce object allocations.
---
 .../src/main/java/org/apache/camel/processor/Splitter.java          | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java b/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java
index 1d2b444..64fd105 100644
--- a/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java
+++ b/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java
@@ -161,7 +161,6 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
     @Override
     protected Iterable<ProcessorExchangePair> createProcessorExchangePairs(Exchange exchange)
             throws Exception {
-        // iter is only currently used by Recipient List EIP so its null
 
         Object value = expression.evaluate(exchange, Object.class);
         if (exchange.getException() != null) {
@@ -211,7 +210,7 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
             this.original = exchange;
             this.value = value;
 
-            if (delimiter != null && IGNORE_DELIMITER_MARKER.equalsIgnoreCase(delimiter)) {
+            if (IGNORE_DELIMITER_MARKER.equalsIgnoreCase(delimiter)) {
                 this.iterator = ObjectHelper.createIterator(value, null);
             } else {
                 this.iterator = ObjectHelper.createIterator(value, delimiter);
@@ -224,6 +223,7 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
         @Override
         public Iterator<ProcessorExchangePair> iterator() {
             return new Iterator<ProcessorExchangePair>() {
+                private final Processor processor = getProcessors().iterator().next();
                 private int index;
                 private boolean closed;
 
@@ -270,7 +270,7 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
                             Message in = newExchange.getIn();
                             in.setBody(part);
                         }
-                        return createProcessorExchangePair(index++, getProcessors().iterator().next(), newExchange, route);
+                        return createProcessorExchangePair(index++, processor, newExchange, route);
                     } else {
                         return null;
                     }