Skip to content

Commit 72590db

Browse files
committed
CachingConnectionFactory does not cache producer for temporary queue/topic
Issue: SPR-16353
1 parent 7a55d93 commit 72590db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -325,7 +325,10 @@ else if (methodName.startsWith("create")) {
325325
if (isCacheProducers() && (methodName.equals("createProducer") ||
326326
methodName.equals("createSender") || methodName.equals("createPublisher"))) {
327327
// Destination argument being null is ok for a producer
328-
return getCachedProducer((Destination) args[0]);
328+
Destination dest = (Destination) args[0];
329+
if (!(dest instanceof TemporaryQueue || dest instanceof TemporaryTopic)) {
330+
return getCachedProducer(dest);
331+
}
329332
}
330333
else if (isCacheConsumers()) {
331334
// let raw JMS invocation throw an exception if Destination (i.e. args[0]) is null

0 commit comments

Comments
 (0)