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) {