This commit is contained in:
Dejan Bosanac 2013-11-19 12:41:10 +01:00
parent bc4f4e92a6
commit bc1ca6c8cf
1 changed files with 11 additions and 14 deletions

View File

@ -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;