From de549f8926988ab436084225cdcd6595f1657262 Mon Sep 17 00:00:00 2001 From: gtully Date: Fri, 23 Jan 2015 12:23:34 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5535 - allow close state reporting w/o contention --- .../src/main/java/org/apache/activemq/ActiveMQConnection.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java index ed0dd47a7a..aef8513943 100755 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java @@ -2550,6 +2550,10 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon protected Scheduler getScheduler() throws JMSException { Scheduler result = scheduler; if (result == null) { + if (isClosing() || isClosed()) { + // without lock contention report the closing state + throw new ConnectionClosedException(); + } synchronized (this) { result = scheduler; if (result == null) {