CachingConnectionFactory makes its Session caching inactive during reset
Issue: SPR-16450
This commit is contained in:
parent
10caaefd0b
commit
b6ecfcf9ec
|
@ -175,6 +175,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
|||
@Override
|
||||
public void resetConnection() {
|
||||
this.active = false;
|
||||
|
||||
synchronized (this.cachedSessions) {
|
||||
for (LinkedList<Session> sessionList : this.cachedSessions.values()) {
|
||||
synchronized (sessionList) {
|
||||
|
@ -190,10 +191,11 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
|||
}
|
||||
this.cachedSessions.clear();
|
||||
}
|
||||
this.active = true;
|
||||
|
||||
// Now proceed with actual closing of the shared Connection...
|
||||
super.resetConnection();
|
||||
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,6 +203,10 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
|||
*/
|
||||
@Override
|
||||
protected Session getSession(Connection con, Integer mode) throws JMSException {
|
||||
if (!this.active) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LinkedList<Session> sessionList;
|
||||
synchronized (this.cachedSessions) {
|
||||
sessionList = this.cachedSessions.get(mode);
|
||||
|
@ -264,11 +270,9 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
|||
|
||||
private final LinkedList<Session> sessionList;
|
||||
|
||||
private final Map<DestinationCacheKey, MessageProducer> cachedProducers =
|
||||
new HashMap<>();
|
||||
private final Map<DestinationCacheKey, MessageProducer> cachedProducers = new HashMap<>();
|
||||
|
||||
private final Map<ConsumerCacheKey, MessageConsumer> cachedConsumers =
|
||||
new HashMap<>();
|
||||
private final Map<ConsumerCacheKey, MessageConsumer> cachedConsumers = new HashMap<>();
|
||||
|
||||
private boolean transactionOpen = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue