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 2017/06/01 17:13:09 UTC

[3/3] camel git commit: Optimise - Exchange copy should preserve exchange id so we dont generte a new uuid which was not needed.

Optimise - Exchange copy should preserve exchange id so we dont generte a new uuid which was not needed.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/661f6f39
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/661f6f39
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/661f6f39

Branch: refs/heads/master
Commit: 661f6f392de987da6f0200ef2e3aaf00a65e0d4d
Parents: 32c1f65
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jun 1 16:49:20 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jun 1 16:49:20 2017 +0200

----------------------------------------------------------------------
 .../file/strategy/GenericFileDeleteProcessStrategy.java         | 3 ++-
 .../file/strategy/GenericFileRenameProcessStrategy.java         | 5 +++--
 .../java/org/apache/camel/language/bean/BeanExpression.java     | 5 +++--
 3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/661f6f39/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
index 9cafde6..2c6490a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileDeleteProcessStrategy.java
@@ -21,6 +21,7 @@ import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.file.GenericFileEndpoint;
 import org.apache.camel.component.file.GenericFileOperationFailedException;
 import org.apache.camel.component.file.GenericFileOperations;
+import org.apache.camel.util.ExchangeHelper;
 
 public class GenericFileDeleteProcessStrategy<T> extends GenericFileProcessStrategySupport<T> {
 
@@ -105,7 +106,7 @@ public class GenericFileDeleteProcessStrategy<T> extends GenericFileProcessStrat
             // moved the failed file if specifying the moveFailed option
             if (failureRenamer != null) {
                 // create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
-                Exchange copy = exchange.copy();
+                Exchange copy = ExchangeHelper.createCopy(exchange, true);
                 file.bindToExchange(copy);
                 // must preserve message id
                 copy.getIn().setMessageId(exchange.getIn().getMessageId());

http://git-wip-us.apache.org/repos/asf/camel/blob/661f6f39/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameProcessStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameProcessStrategy.java b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameProcessStrategy.java
index 9271b0f..e14a8b2 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameProcessStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/strategy/GenericFileRenameProcessStrategy.java
@@ -20,6 +20,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.file.GenericFileEndpoint;
 import org.apache.camel.component.file.GenericFileOperations;
+import org.apache.camel.util.ExchangeHelper;
 
 public class GenericFileRenameProcessStrategy<T> extends GenericFileProcessStrategySupport<T> {
     private GenericFileRenamer<T> beginRenamer;
@@ -56,7 +57,7 @@ public class GenericFileRenameProcessStrategy<T> extends GenericFileProcessStrat
 
             if (failureRenamer != null) {
                 // create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
-                Exchange copy = exchange.copy();
+                Exchange copy = ExchangeHelper.createCopy(exchange, true);
                 file.bindToExchange(copy);
                 // must preserve message id
                 copy.getIn().setMessageId(exchange.getIn().getMessageId());
@@ -78,7 +79,7 @@ public class GenericFileRenameProcessStrategy<T> extends GenericFileProcessStrat
         try {
             if (commitRenamer != null) {
                 // create a copy and bind the file to the exchange to be used by the renamer to evaluate the file name
-                Exchange copy = exchange.copy();
+                Exchange copy = ExchangeHelper.createCopy(exchange, true);
                 file.bindToExchange(copy);
                 // must preserve message id
                 copy.getIn().setMessageId(exchange.getIn().getMessageId());

http://git-wip-us.apache.org/repos/asf/camel/blob/661f6f39/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
index 21255db..13d857d 100644
--- a/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
+++ b/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
@@ -31,6 +31,7 @@ import org.apache.camel.component.bean.ConstantBeanHolder;
 import org.apache.camel.component.bean.ConstantTypeBeanHolder;
 import org.apache.camel.component.bean.RegistryBean;
 import org.apache.camel.language.simple.SimpleLanguage;
+import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.KeyValueHolder;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.OgnlHelper;
@@ -190,7 +191,7 @@ public class BeanExpression implements Expression, Predicate {
         }
         try {
             // copy the original exchange to avoid side effects on it
-            Exchange resultExchange = exchange.copy();
+            Exchange resultExchange = ExchangeHelper.createCopy(exchange, true);
             // remove any existing exception in case we do OGNL on the exception
             resultExchange.setException(null);
 
@@ -230,7 +231,7 @@ public class BeanExpression implements Expression, Predicate {
         Object result = beanHolder.getBean();
 
         // copy the original exchange to avoid side effects on it
-        Exchange resultExchange = exchange.copy();
+        Exchange resultExchange = ExchangeHelper.createCopy(exchange, true);
         // remove any existing exception in case we do OGNL on the exception
         resultExchange.setException(null);
         // force to use InOut to retrieve the result on the OUT message