camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1199804 - /camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java
Date Wed, 09 Nov 2011 15:41:32 GMT
Author: davsclaus
Date: Wed Nov  9 15:41:32 2011
New Revision: 1199804

URL: http://svn.apache.org/viewvc?rev=1199804&view=rev
Log:
CAMEL-2740: Fixed memory leak when doing request/reply over JMS with a fixed replyTo queue.
Due correlationIDs in JMSMessage Selector not in sync with current active correlation ids.

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java?rev=1199804&r1=1199803&r2=1199804&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/MessageSelectorCreator.java
Wed Nov  9 15:41:32 2011
@@ -16,8 +16,7 @@
  */
 package org.apache.camel.component.jms.reply;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
+import java.util.concurrent.ConcurrentSkipListSet;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,7 +28,7 @@ import org.slf4j.LoggerFactory;
 public class MessageSelectorCreator implements CorrelationListener {
     protected static final Logger LOG = LoggerFactory.getLogger(MessageSelectorCreator.class);
     protected final CorrelationTimeoutMap timeoutMap;
-    protected final Set<String> correlationIds;
+    protected final ConcurrentSkipListSet<String> correlationIds;
     protected boolean dirty = true;
     protected StringBuilder expression;
 
@@ -38,7 +37,8 @@ public class MessageSelectorCreator impl
         this.timeoutMap.setListener(this);
         // create local set of correlation ids, as its easier to keep track
         // using the listener so we can flag the dirty flag upon changes
-        this.correlationIds = new LinkedHashSet<String>();
+        // must support concurrent access
+        this.correlationIds = new ConcurrentSkipListSet<String>();
     }
 
     public synchronized String get() {
@@ -64,8 +64,10 @@ public class MessageSelectorCreator impl
             }
         }
 
+        String answer = expression.toString();
+
         dirty = false;
-        return expression.toString();
+        return answer;
     }
 
     public void onPut(String key) {



Mime
View raw message