Skip to content

Commit bf4cada

Browse files
committed
CachingConnectionFactory does not cache producer for temporary queue/topic
Issue: SPR-16353 (cherry picked from commit 72590db)
1 parent a9bad58 commit bf4cada

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-2016 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.
@@ -335,7 +335,10 @@ else if (methodName.startsWith("create")) {
335335
if (isCacheProducers() && (methodName.equals("createProducer") ||
336336
methodName.equals("createSender") || methodName.equals("createPublisher"))) {
337337
// Destination argument being null is ok for a producer
338-
return getCachedProducer((Destination) args[0]);
338+
Destination dest = (Destination) args[0];
339+
if (!(dest instanceof TemporaryQueue || dest instanceof TemporaryTopic)) {
340+
return getCachedProducer(dest);
341+
}
339342
}
340343
else if (isCacheConsumers()) {
341344
// let raw JMS invocation throw an exception if Destination (i.e. args[0]) is null

0 commit comments

Comments
 (0)