@@ -175,6 +175,7 @@ public boolean isCacheConsumers() {
175
175
@ Override
176
176
public void resetConnection () {
177
177
this .active = false ;
178
+
178
179
synchronized (this .cachedSessions ) {
179
180
for (LinkedList <Session > sessionList : this .cachedSessions .values ()) {
180
181
synchronized (sessionList ) {
@@ -190,17 +191,22 @@ public void resetConnection() {
190
191
}
191
192
this .cachedSessions .clear ();
192
193
}
193
- this .active = true ;
194
194
195
195
// Now proceed with actual closing of the shared Connection...
196
196
super .resetConnection ();
197
+
198
+ this .active = true ;
197
199
}
198
200
199
201
/**
200
202
* Checks for a cached Session for the given mode.
201
203
*/
202
204
@ Override
203
205
protected Session getSession (Connection con , Integer mode ) throws JMSException {
206
+ if (!this .active ) {
207
+ return null ;
208
+ }
209
+
204
210
LinkedList <Session > sessionList ;
205
211
synchronized (this .cachedSessions ) {
206
212
sessionList = this .cachedSessions .get (mode );
@@ -264,11 +270,9 @@ private class CachedSessionInvocationHandler implements InvocationHandler {
264
270
265
271
private final LinkedList <Session > sessionList ;
266
272
267
- private final Map <DestinationCacheKey , MessageProducer > cachedProducers =
268
- new HashMap <>();
273
+ private final Map <DestinationCacheKey , MessageProducer > cachedProducers = new HashMap <>();
269
274
270
- private final Map <ConsumerCacheKey , MessageConsumer > cachedConsumers =
271
- new HashMap <>();
275
+ private final Map <ConsumerCacheKey , MessageConsumer > cachedConsumers = new HashMap <>();
272
276
273
277
private boolean transactionOpen = false ;
274
278
0 commit comments