From 6fd0fc7005f2c8a8b4f995e981fcf5838d055cbf Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sat, 5 Jul 2014 08:49:28 +0200 Subject: [PATCH] CachedSessionInvocationHandler includes durable flag in ConsumerCacheKey Issue: SPR-11956 --- .../jms/connection/CachingConnectionFactory.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java index a5cfbcba54..1296be2927 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java @@ -403,7 +403,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory { private MessageConsumer getCachedConsumer( Destination dest, String selector, Boolean noLocal, String subscription, boolean durable) throws JMSException { - ConsumerCacheKey cacheKey = new ConsumerCacheKey(dest, selector, noLocal, subscription); + ConsumerCacheKey cacheKey = new ConsumerCacheKey(dest, selector, noLocal, subscription, durable); MessageConsumer consumer = this.cachedConsumers.get(cacheKey); if (consumer != null) { if (logger.isTraceEnabled()) { @@ -554,11 +554,14 @@ public class CachingConnectionFactory extends SingleConnectionFactory { private final String subscription; - public ConsumerCacheKey(Destination destination, String selector, Boolean noLocal, String subscription) { + private final boolean durable; + + public ConsumerCacheKey(Destination destination, String selector, Boolean noLocal, String subscription, boolean durable) { super(destination); this.selector = selector; this.noLocal = noLocal; this.subscription = subscription; + this.durable = durable; } @Override @@ -570,7 +573,8 @@ public class CachingConnectionFactory extends SingleConnectionFactory { return (destinationEquals(otherKey) && ObjectUtils.nullSafeEquals(this.selector, otherKey.selector) && ObjectUtils.nullSafeEquals(this.noLocal, otherKey.noLocal) && - ObjectUtils.nullSafeEquals(this.subscription, otherKey.subscription)); + ObjectUtils.nullSafeEquals(this.subscription, otherKey.subscription) && + this.durable == otherKey.durable); } }