Class RetryOnFailureOperation<T>

java.lang.Object
java.util.concurrent.CompletableFuture<T>
org.infinispan.hotrod.impl.operations.HotRodOperation<T>
org.infinispan.hotrod.impl.operations.RetryOnFailureOperation<T>
All Implemented Interfaces:
Runnable, CompletionStage<T>, Future<T>, HotRodConstants, ChannelOperation
Direct Known Subclasses:
AddListenerOperation, AddOperation, ClearOperation, ClientListenerOperation, CompareAndSwapOperation, CompleteTransactionOperation, ContainsValueMultimapOperation, DefineCounterOperation, ExecuteOperation, FaultTolerantPingOperation, ForgetTransactionOperation, GetConfigurationOperation, GetCounterNamesOperation, GetValueOperation, IsDefinedOperation, IterationStartOperation, PrepareTransactionOperation, QueryOperation, RecoveryOperation, RemoveListenerOperation, RemoveOperation, ResetOperation, SetOperation, SizeMultimapOperation, SizeOperation, StatsAffectingRetryingOperation, StatsOperation

public abstract class RetryOnFailureOperation<T> extends HotRodOperation<T> implements ChannelOperation
Base class for all the operations that need retry logic: if the operation fails due to connection problems, try with another available connection.
Since:
14.0
  • Field Details

    • log

      protected static final Log log
  • Constructor Details

    • RetryOnFailureOperation

      protected RetryOnFailureOperation(OperationContext operationContext, short requestCode, short responseCode, org.infinispan.api.common.CacheOptions options, DataFormat dataFormat)
  • Method Details

    • execute

      public CompletionStage<T> execute()
      Specified by:
      execute in class HotRodOperation<T>
    • invoke

      public void invoke(io.netty.channel.Channel channel)
      Description copied from interface: ChannelOperation
      Invoked on an active channel ready to be written
      Specified by:
      invoke in interface ChannelOperation
    • cancel

      public void cancel(SocketAddress address, Throwable cause)
      Description copied from interface: ChannelOperation
      Invoked when the callback cannot be invoked due to timeout or terminated pool.
      Specified by:
      cancel in interface ChannelOperation
      Parameters:
      address -
      cause -
    • reset

      protected void reset()
    • channelInactive

      public void channelInactive(io.netty.channel.Channel channel)
      Overrides:
      channelInactive in class HotRodOperation<T>
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.Channel channel, Throwable cause)
      Overrides:
      exceptionCaught in class HotRodOperation<T>
    • handleException

      protected Throwable handleException(Throwable cause, io.netty.channel.Channel channel, SocketAddress address)
    • logAndRetryOrFail

      protected void logAndRetryOrFail(Throwable e)
    • fetchChannelAndInvoke

      protected void fetchChannelAndInvoke(int retryCount, Set<SocketAddress> failedServers)
    • executeOperation

      protected abstract void executeOperation(io.netty.channel.Channel channel)
      Perform the operation-specific request/response I/O on the specified channel. If an error occurs during I/O, this class will detect it and retry the operation with a different channel by invoking the executeOperation method again.
      Parameters:
      channel - the channel to use for I/O