Issue #2357: Close JmsSession when it has no producers or consumers

Change-Id: Icd0d29c0e6a43109ac26a1d1ad1bbeef9d7aca5f

Former-commit-id: c3529a1769 [formerly fe249a9fc2 [formerly 953ddccdb0] [formerly c3529a1769 [formerly 2a152d5ef2b0e3f54948f3679be74ecd717c02f9]]]
Former-commit-id: fe249a9fc2 [formerly 953ddccdb0]
Former-commit-id: fe249a9fc2
Former-commit-id: 60d691f58c
This commit is contained in:
Richard Peter 2014-01-16 20:29:50 -06:00
parent 1f34e56258
commit 8fa268d835

View file

@ -60,6 +60,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Apr 15, 2011 rjpeter Initial creation
* Mar 08, 2012 194 njensen Improved logging
* Feb 21, 2013 1642 rjpeter Fix deadlock scenario
* Jan 26, 2014 2357 rjpeter Close a session when it has no producers or consumers.
* </pre>
*
* @author rjpeter
@ -627,7 +628,7 @@ public class JmsPooledSession {
}
}
boolean valid = isValid();
boolean valid = isValid() && hasProducersOrConsumers();
if (valid && returnToPool) {
valid = conn.returnSessionToPool(this);
}
@ -654,4 +655,10 @@ public class JmsPooledSession {
public Object getStateLock() {
return stateLock;
}
public boolean hasProducersOrConsumers() {
return !inUseConsumers.isEmpty() || !inUseProducers.isEmpty()
|| !availableConsumers.isEmpty()
|| !availableProducers.isEmpty();
}
}