use of org.infinispan.client.hotrod.exceptions.RemoteNodeSuspectException in project infinispan by infinispan.
the class RetryOnFailureOperation method handleException.
protected Throwable handleException(Throwable cause, Channel channel, SocketAddress address) {
while (cause instanceof DecoderException && cause.getCause() != null) {
cause = cause.getCause();
}
if (cause instanceof RemoteIllegalLifecycleStateException || cause instanceof IOException || cause instanceof TransportException) {
if (Thread.interrupted()) {
// Don't invalidate the transport if our thread was interrupted
completeExceptionally(new InterruptedException());
return null;
}
if (address != null) {
addFailedServer(address);
}
if (channel != null) {
// We need to remove decoder even if we're about to close the channel
// because otherwise we would be notified through channelInactive and we would retry (again).
HeaderDecoder headerDecoder = (HeaderDecoder) channel.pipeline().get(HeaderDecoder.NAME);
if (headerDecoder != null) {
channel.pipeline().remove(HeaderDecoder.NAME);
}
HOTROD.closingChannelAfterError(channel, cause);
channel.close();
if (headerDecoder != null) {
headerDecoder.failoverClientListeners();
}
}
logAndRetryOrFail(cause);
return null;
} else if (cause instanceof RemoteNodeSuspectException) {
// TODO Clients should never receive a RemoteNodeSuspectException, see ISPN-11636
logAndRetryOrFail(cause);
return null;
} else if (cause instanceof HotRodClientException && ((HotRodClientException) cause).isServerError()) {
// fail the operation (don't retry) but don't close the channel
completeExceptionally(cause);
return null;
} else {
return cause;
}
}
Aggregations