mirror of
https://github.com/apache/activemq.git
synced 2025-02-18 07:56:20 +00:00
[AMQ-6792] fire the failover exception handler before stop to ensure blocked write does not block stop request
(cherry picked from commit 63f0b7e20d56837b4f159e83594a4e4fb906cd4a)
This commit is contained in:
parent
f7185b992e
commit
0924f983f8
@ -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…
x
Reference in New Issue
Block a user