Created
November 18, 2013 16:35
-
-
Save dejanb/7530926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public final void handleTransportFailure(IOException e) throws InterruptedException { | |
| if (LOG.isTraceEnabled()) { | |
| LOG.trace(this + " handleTransportFailure: " + e); | |
| } | |
| synchronized (reconnectMutex) { | |
| Transport transport = connectedTransport.getAndSet(null); | |
| if (transport != null) { | |
| disposeTransport(transport); | |
| boolean reconnectOk = false; | |
| if (canReconnect()) { | |
| reconnectOk = true; | |
| } | |
| LOG.warn("Transport (" + transport.getRemoteAddress() + ") failed, reason: " + e | |
| + (reconnectOk ? "," : ", not") + " attempting to automatically reconnect"); | |
| initialized = false; | |
| failedConnectTransportURI = connectedTransportURI; | |
| connectedTransportURI = null; | |
| connected = false; | |
| connectedToPriority = false; | |
| if (reconnectOk) { | |
| // notify before any reconnect attempt so ack state can be whacked | |
| if (transportListener != null) { | |
| transportListener.transportInterupted(); | |
| } | |
| updated.remove(failedConnectTransportURI); | |
| reconnectTask.wakeup(); | |
| } else if (!isDisposed()) { | |
| propagateFailureToExceptionListener(e); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment