diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java index 2c152790e9..eac713d47e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java @@ -258,6 +258,7 @@ public class FailoverTransport implements CompositeTransport { } public void stop() throws Exception { + Transport transportToStop=null; synchronized (reconnectMutex) { LOG.debug("Stopped."); if (!started) { @@ -267,7 +268,7 @@ public class FailoverTransport implements CompositeTransport { disposed = true; if (connectedTransport != null) { - connectedTransport.stop(); + transportToStop = connectedTransport; connectedTransport = null; } reconnectMutex.notifyAll(); @@ -276,6 +277,9 @@ public class FailoverTransport implements CompositeTransport { sleepMutex.notifyAll(); } reconnectTask.shutdown(); + if( transportToStop!=null ) { + transportToStop.stop(); + } } public long getInitialReconnectDelay() {