activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [15/17] activemq git commit: 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
Date Mon, 15 Dec 2014 23:22:00 GMT
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/dc900a3d
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/dc900a3d
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/dc900a3d

Branch: refs/heads/activemq-5.10.x
Commit: dc900a3d5c5c8a45bb92c82a09bb075838abdc97
Parents: 70b02fd
Author: gtully <gary.tully@gmail.com>
Authored: Mon Jun 23 12:12:39 2014 +0100
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Mon Dec 15 17:03:53 2014 -0500

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


http://git-wip-us.apache.org/repos/asf/activemq/blob/dc900a3d/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


Mime
View raw message