Repository: activemq
Updated Branches:
  refs/heads/trunk 8824ac9fc -> ce911bafb


https://issues.apache.org/jira/browse/AMQ-5241 - track window between sending 
shutdown info and doing local close to avoid race with broker on normal 
connection.close - needs two jvm to reliably reproduce so no unit test with the 
fix


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/ce911baf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/ce911baf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/ce911baf

Branch: refs/heads/trunk
Commit: ce911bafbfc4bab88fbd0827273ab4e9ee2de0f7
Parents: 8824ac9
Author: gtully <gary.tu...@gmail.com>
Authored: Mon Jun 23 12:12:39 2014 +0100
Committer: gtully <gary.tu...@gmail.com>
Committed: Mon Jun 23 12:13:45 2014 +0100

----------------------------------------------------------------------
 .../activemq/transport/failover/FailoverTransport.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/ce911baf/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
----------------------------------------------------------------------
diff --git 
a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
 
b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
index 6df82ed..c9ef141 100755
--- 
a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
+++ 
b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
@@ -128,6 +128,7 @@ public class FailoverTransport implements 
CompositeTransport {
     private final ArrayList<URI> priorityList = new ArrayList<URI>();
     private boolean priorityBackupAvailable = false;
     private String nestedExtraQueryOptions;
+    private boolean shuttingDown = false;
 
     public FailoverTransport() throws InterruptedIOException {
         brokerSslContext = SslContext.getCurrentSslContext();
@@ -242,6 +243,12 @@ public class FailoverTransport implements 
CompositeTransport {
 
     public final void handleTransportFailure(IOException e) throws 
InterruptedException {
         synchronized (reconnectMutex) {
+            if (shuttingDown) {
+                // shutdown info sent and remote socket closed and we see that 
before a local close
+                // let the close do the work
+                return;
+            }
+
             if (LOG.isTraceEnabled()) {
                 LOG.trace(this + " handleTransportFailure: " + e, e);
             }
@@ -257,7 +264,7 @@ public class FailoverTransport implements 
CompositeTransport {
                 if (canReconnect()) {
                     reconnectOk = true;
                 }
-                LOG.warn("Transport (" + transport + ") failed, reason:  "
+                LOG.warn("Transport (" + transport + ") failed"
                         + (reconnectOk ? "," : ", not") + " attempting to 
automatically reconnect", e);
 
                 initialized = false;
@@ -657,6 +664,9 @@ public class FailoverTransport implements 
CompositeTransport {
                         try {
                             transport.oneway(command);
                             stateTracker.trackBack(command);
+                            if (command.isShutdownInfo()) {
+                                shuttingDown = true;
+                            }
                         } catch (IOException e) {
 
                             // If the command was not tracked.. we will retry 
in

Reply via email to