activemq git commit: [AMQ-6792] fire the failover exception handler before stop to ensure blocked write does not block stop request

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

activemq git commit: [AMQ-6792] fire the failover exception handler before stop to ensure blocked write does not block stop request

gtully-2
Repository: activemq
Updated Branches:
  refs/heads/master 068b7946c -> 63f0b7e20


[AMQ-6792] fire the failover exception handler before stop to ensure blocked write does not block stop request


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

Branch: refs/heads/master
Commit: 63f0b7e20d56837b4f159e83594a4e4fb906cd4a
Parents: 068b794
Author: gtully <[hidden email]>
Authored: Fri Aug 11 12:58:51 2017 +0100
Committer: gtully <[hidden email]>
Committed: Fri Aug 11 12:58:51 2017 +0100

----------------------------------------------------------------------
 .../activemq/network/DemandForwardingBridgeSupport.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/63f0b7e2/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
index 5070266..879ab39 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
@@ -93,6 +93,7 @@ import org.apache.activemq.transport.ResponseCallback;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportDisposedIOException;
 import org.apache.activemq.transport.TransportFilter;
+import org.apache.activemq.transport.failover.FailoverTransport;
 import org.apache.activemq.transport.tcp.SslTransport;
 import org.apache.activemq.transport.tcp.TcpTransport;
 import org.apache.activemq.util.IdGenerator;
@@ -323,6 +324,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
                     }
                 } finally {
                     ServiceStopper ss = new ServiceStopper();
+                    stopFailoverTransport(remoteBroker);
                     ss.stop(remoteBroker);
                     ss.stop(localBroker);
                     ss.stop(duplexInboundLocalBroker);
@@ -341,6 +343,16 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge, Br
         }
     }
 
+    private void stopFailoverTransport(Transport transport) {
+        FailoverTransport failoverTransport = transport.narrow(FailoverTransport.class);
+        if (failoverTransport != null) {
+            // may be blocked on write, in which case stop will block
+            try {
+                failoverTransport.handleTransportFailure(new IOException("Bridge stopped"));
+            } catch (InterruptedException ignored) {}
+        }
+    }
+
     protected void triggerStartAsyncNetworkBridgeCreation() throws IOException {
         brokerService.getTaskRunnerFactory().execute(new Runnable() {
             @Override

Loading...