Browse Source

CachingConnectionFactory does not cache producer for temporary queue/topic

Issue: SPR-16353
pull/1631/merge
Juergen Hoeller 8 years ago
parent
commit
72590dbb21
  1. 7
      spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java

7
spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2017 the original author or authors. * Copyright 2002-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -325,7 +325,10 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
if (isCacheProducers() && (methodName.equals("createProducer") || if (isCacheProducers() && (methodName.equals("createProducer") ||
methodName.equals("createSender") || methodName.equals("createPublisher"))) { methodName.equals("createSender") || methodName.equals("createPublisher"))) {
// Destination argument being null is ok for a producer // Destination argument being null is ok for a producer
return getCachedProducer((Destination) args[0]); Destination dest = (Destination) args[0];
if (!(dest instanceof TemporaryQueue || dest instanceof TemporaryTopic)) {
return getCachedProducer(dest);
}
} }
else if (isCacheConsumers()) { else if (isCacheConsumers()) {
// let raw JMS invocation throw an exception if Destination (i.e. args[0]) is null // let raw JMS invocation throw an exception if Destination (i.e. args[0]) is null

Loading…
Cancel
Save