CAMEL-10048: Fixed memory leak in routing slip. Thanks to Arseniy Tashoyan for 
the patch.


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

Branch: refs/heads/camel-2.17.x
Commit: 900cf6947a2142fb7d0b4fa31931da0704744228
Parents: be70180
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sun Jun 12 11:39:46 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sun Jun 12 11:40:40 2016 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/processor/RoutingSlip.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/900cf694/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java 
b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
index 641834c..d2d46af 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
@@ -80,9 +80,9 @@ public class RoutingSlip extends ServiceSupport implements 
AsyncProcessor, Trace
      * <p/>
      * This is similar to how multicast processor does.
      */
-    static final class PreparedErrorHandler extends 
KeyValueHolder<RouteContext, Processor> {
+    static final class PreparedErrorHandler extends KeyValueHolder<String, 
Processor> {
 
-        PreparedErrorHandler(RouteContext key, Processor value) {
+        PreparedErrorHandler(String key, Processor value) {
             super(key, value);
         }
 
@@ -324,7 +324,7 @@ public class RoutingSlip extends ServiceSupport implements 
AsyncProcessor, Trace
         return copy;
     }
 
-    protected AsyncProcessor createErrorHandler(RouteContext routeContext, 
Exchange exchange, AsyncProcessor processor) {
+    protected AsyncProcessor createErrorHandler(RouteContext routeContext, 
Exchange exchange, AsyncProcessor processor, Endpoint endpoint) {
         AsyncProcessor answer = processor;
 
         boolean tryBlock = exchange.getProperty(Exchange.TRY_ROUTE_BLOCK, 
false, boolean.class);
@@ -337,7 +337,7 @@ public class RoutingSlip extends ServiceSupport implements 
AsyncProcessor, Trace
             // for the entire routingslip/dynamic-router block again which 
will start from scratch again
 
             // create key for cache
-            final PreparedErrorHandler key = new 
PreparedErrorHandler(routeContext, processor);
+            final PreparedErrorHandler key = new 
PreparedErrorHandler(endpoint.getEndpointUri(), processor);
 
             // lookup cached first to reuse and preserve memory
             answer = errorHandlers.get(key);
@@ -379,7 +379,7 @@ public class RoutingSlip extends ServiceSupport implements 
AsyncProcessor, Trace
 
                 // rework error handling to support fine grained error handling
                 RouteContext routeContext = exchange.getUnitOfWork() != null ? 
exchange.getUnitOfWork().getRouteContext() : null;
-                asyncProducer = createErrorHandler(routeContext, exchange, 
asyncProducer);
+                asyncProducer = createErrorHandler(routeContext, exchange, 
asyncProducer, endpoint);
 
                 // set property which endpoint we send to
                 exchange.setProperty(Exchange.TO_ENDPOINT, 
endpoint.getEndpointUri());

Reply via email to