Search in sources :

Example 1 with RemoteIllegalLifecycleStateException

use of org.infinispan.client.hotrod.exceptions.RemoteIllegalLifecycleStateException 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;
    }
}
Also used : DecoderException(io.netty.handler.codec.DecoderException) HeaderDecoder(org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder) RemoteIllegalLifecycleStateException(org.infinispan.client.hotrod.exceptions.RemoteIllegalLifecycleStateException) IOException(java.io.IOException) HotRodClientException(org.infinispan.client.hotrod.exceptions.HotRodClientException) TransportException(org.infinispan.client.hotrod.exceptions.TransportException) RemoteNodeSuspectException(org.infinispan.client.hotrod.exceptions.RemoteNodeSuspectException)

Example 2 with RemoteIllegalLifecycleStateException

use of org.infinispan.client.hotrod.exceptions.RemoteIllegalLifecycleStateException in project infinispan by infinispan.

the class RemoteInnerPublisherHandler method handleThrowableInResponse.

@Override
protected void handleThrowableInResponse(Throwable t, Map.Entry<SocketAddress, IntSet> target) {
    if (t instanceof TransportException || t instanceof RemoteIllegalLifecycleStateException) {
        log.throwableDuringPublisher(t);
        if (log.isTraceEnabled()) {
            IntSet targetSegments = target.getValue();
            if (targetSegments != null) {
                log.tracef("There are still outstanding segments %s that will need to be retried", targetSegments);
            }
        }
        publisher.erroredServer(target.getKey());
        // Try next target if possible
        targetComplete();
        accept(0);
    } else {
        t.addSuppressed(new TraceException());
        super.handleThrowableInResponse(t, target);
    }
}
Also used : TraceException(org.infinispan.commons.util.logging.TraceException) IntSet(org.infinispan.commons.util.IntSet) RemoteIllegalLifecycleStateException(org.infinispan.client.hotrod.exceptions.RemoteIllegalLifecycleStateException) TransportException(org.infinispan.client.hotrod.exceptions.TransportException)

Aggregations

RemoteIllegalLifecycleStateException (org.infinispan.client.hotrod.exceptions.RemoteIllegalLifecycleStateException)2 TransportException (org.infinispan.client.hotrod.exceptions.TransportException)2 DecoderException (io.netty.handler.codec.DecoderException)1 IOException (java.io.IOException)1 HotRodClientException (org.infinispan.client.hotrod.exceptions.HotRodClientException)1 RemoteNodeSuspectException (org.infinispan.client.hotrod.exceptions.RemoteNodeSuspectException)1 HeaderDecoder (org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder)1 IntSet (org.infinispan.commons.util.IntSet)1 TraceException (org.infinispan.commons.util.logging.TraceException)1