mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4897 - race condition in failover transport
This commit is contained in:
parent
bc4f4e92a6
commit
bc1ca6c8cf
|
@ -241,27 +241,24 @@ public class FailoverTransport implements CompositeTransport {
|
|||
}
|
||||
|
||||
public final void handleTransportFailure(IOException e) throws InterruptedException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(this + " handleTransportFailure: " + e);
|
||||
}
|
||||
Transport transport = connectedTransport.getAndSet(null);
|
||||
if (transport == null) {
|
||||
// sync with possible in progress reconnect
|
||||
synchronized (reconnectMutex) {
|
||||
transport = connectedTransport.getAndSet(null);
|
||||
synchronized (reconnectMutex) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(this + " handleTransportFailure: " + e);
|
||||
}
|
||||
}
|
||||
if (transport != null) {
|
||||
|
||||
disposeTransport(transport);
|
||||
Transport transport = connectedTransport.getAndSet(null);
|
||||
|
||||
if (transport != null) {
|
||||
|
||||
disposeTransport(transport);
|
||||
|
||||
boolean reconnectOk = false;
|
||||
|
||||
boolean reconnectOk = false;
|
||||
synchronized (reconnectMutex) {
|
||||
if (canReconnect()) {
|
||||
reconnectOk = true;
|
||||
}
|
||||
LOG.warn("Transport (" + transport.getRemoteAddress() + ") failed, reason: " + e
|
||||
+ (reconnectOk ? "," : ", not") +" attempting to automatically reconnect");
|
||||
+ (reconnectOk ? "," : ", not") + " attempting to automatically reconnect");
|
||||
|
||||
initialized = false;
|
||||
failedConnectTransportURI = connectedTransportURI;
|
||||
|
|
Loading…
Reference in New Issue