https://issues.apache.org/jira/browse/AMQ-5535 - allow close state reporting w/o contention

This commit is contained in:
gtully 2015-01-23 12:23:34 +00:00
parent c9c1f587ad
commit de549f8926
1 changed files with 4 additions and 0 deletions

View File

@ -2550,6 +2550,10 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
protected Scheduler getScheduler() throws JMSException { protected Scheduler getScheduler() throws JMSException {
Scheduler result = scheduler; Scheduler result = scheduler;
if (result == null) { if (result == null) {
if (isClosing() || isClosed()) {
// without lock contention report the closing state
throw new ConnectionClosedException();
}
synchronized (this) { synchronized (this) {
result = scheduler; result = scheduler;
if (result == null) { if (result == null) {