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