CachingConnectionFactory does not cache producer for temporary queue/topic

Issue: SPR-16353
This commit is contained in:
Juergen Hoeller
2018-01-08 00:26:29 +01:00
parent 7a55d932f9
commit 72590dbb21

View File

@@ -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