Repository: camel
Updated Branches:
  refs/heads/master b3ca9219f -> 2386efa7c


Optimise - Use plain HashMap as in DefaultExchange when copying exchange 
properties


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

Branch: refs/heads/master
Commit: 2386efa7cb96a6ca526ab4f8181d9a26850fec26
Parents: b3ca921
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Jun 1 11:04:34 2017 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Jun 1 11:04:34 2017 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/util/ExchangeHelper.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2386efa7/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java 
b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
index 6e5967e..06fe7bf 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -878,7 +877,7 @@ public final class ExchangeHelper {
     public static Exchange copyExchangeAndSetCamelContext(Exchange exchange, 
CamelContext context, boolean handover) {
         DefaultExchange answer = new DefaultExchange(context, 
exchange.getPattern());
         if (exchange.hasProperties()) {
-            answer.setProperties(safeCopy(exchange.getProperties()));
+            answer.setProperties(safeCopyProperties(exchange.getProperties()));
         }
         if (handover) {
             // Need to hand over the completion for async invocation
@@ -940,12 +939,12 @@ public final class ExchangeHelper {
     }
 
     @SuppressWarnings("unchecked")
-    private static Map<String, Object> safeCopy(Map<String, Object> 
properties) {
+    private static Map<String, Object> safeCopyProperties(Map<String, Object> 
properties) {
         if (properties == null) {
             return null;
         }
 
-        Map<String, Object> answer = new ConcurrentHashMap<String, 
Object>(properties);
+        Map<String, Object> answer = new HashMap<>(properties);
 
         // safe copy message history using a defensive copy
         List<MessageHistory> history = (List<MessageHistory>) 
answer.remove(Exchange.MESSAGE_HISTORY);

Reply via email to