Class RetryOnFailureOperation<T>
- java.lang.Object
-
- java.util.concurrent.CompletableFuture<T>
-
- org.infinispan.client.hotrod.impl.operations.HotRodOperation<T>
-
- org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation<T>
-
- All Implemented Interfaces:
Runnable
,CompletionStage<T>
,Future<T>
,HotRodConstants
,ChannelOperation
- Direct Known Subclasses:
AbstractKeyOperation
,AddClientListenerOperation
,AddListenerOperation
,AddOperation
,BulkGetKeysOperation
,BulkGetOperation
,ClearOperation
,CompareAndSwapOperation
,CompleteTransactionOperation
,ContainsValueMultimapOperation
,DefineCounterOperation
,ExecuteOperation
,FaultTolerantPingOperation
,GetAllOperation
,GetConfigurationOperation
,GetCounterNamesOperation
,GetValueOperation
,IsDefinedOperation
,IterationStartOperation
,PrepareTransactionOperation
,PutAllOperation
,QueryOperation
,RemoveListenerOperation
,RemoveOperation
,ResetOperation
,SizeMultimapOperation
,SizeOperation
,StatsOperation
@Immutable 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:
- 4.1
- Author:
- Mircea.Markus@jboss.com
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture
CompletableFuture.AsynchronousCompletionTask
-
Nested classes/interfaces inherited from interface org.infinispan.client.hotrod.impl.protocol.HotRodConstants
HotRodConstants.Names
-
-
Field Summary
Fields Modifier and Type Field Description protected static Log
log
protected static boolean
trace
-
Fields inherited from class org.infinispan.client.hotrod.impl.operations.HotRodOperation
cacheName, cfg, channelFactory, codec, dataFormat, flags, header, timeoutFuture
-
Fields inherited from interface org.infinispan.client.hotrod.impl.protocol.HotRodConstants
ADD_CLIENT_LISTENER_REQUEST, ADD_CLIENT_LISTENER_RESPONSE, AUTH_MECH_LIST_REQUEST, AUTH_MECH_LIST_RESPONSE, AUTH_REQUEST, AUTH_RESPONSE, BULK_GET_KEYS_REQUEST, BULK_GET_KEYS_RESPONSE, BULK_GET_REQUEST, BULK_GET_RESPONSE, CACHE_ENTRY_CREATED_EVENT_RESPONSE, CACHE_ENTRY_EXPIRED_EVENT_RESPONSE, CACHE_ENTRY_MODIFIED_EVENT_RESPONSE, CACHE_ENTRY_REMOVED_EVENT_RESPONSE, CLEAR_REQUEST, CLEAR_RESPONSE, CLIENT_INTELLIGENCE_BASIC, CLIENT_INTELLIGENCE_HASH_DISTRIBUTION_AWARE, CLIENT_INTELLIGENCE_TOPOLOGY_AWARE, COMMAND_TIMEOUT_STATUS, COMMIT_REQUEST, COMMIT_RESPONSE, CONTAINS_KEY_REQUEST, CONTAINS_KEY_RESPONSE, COUNTER_ADD_AND_GET_REQUEST, COUNTER_ADD_AND_GET_RESPONSE, COUNTER_ADD_LISTENER_REQUEST, COUNTER_ADD_LISTENER_RESPONSE, COUNTER_CAS_REQUEST, COUNTER_CAS_RESPONSE, COUNTER_CREATE_REQUEST, COUNTER_CREATE_RESPONSE, COUNTER_EVENT_RESPONSE, COUNTER_GET_CONFIGURATION_REQUEST, COUNTER_GET_CONFIGURATION_RESPONSE, COUNTER_GET_NAMES_REQUEST, COUNTER_GET_NAMES_RESPONSE, COUNTER_GET_REQUEST, COUNTER_GET_RESPONSE, COUNTER_IS_DEFINED_REQUEST, COUNTER_IS_DEFINED_RESPONSE, COUNTER_REMOVE_LISTENER_REQUEST, COUNTER_REMOVE_LISTENER_RESPONSE, COUNTER_REMOVE_REQUEST, COUNTER_REMOVE_RESPONSE, COUNTER_RESET_REQUEST, COUNTER_RESET_RESPONSE, DEFAULT_CACHE_NAME_BYTES, DEFAULT_CACHE_TOPOLOGY, ERROR_RESPONSE, EXEC_REQUEST, EXEC_RESPONSE, GET_ALL_REQUEST, GET_ALL_RESPONSE, GET_REQUEST, GET_RESPONSE, GET_STREAM_REQUEST, GET_STREAM_RESPONSE, GET_WITH_METADATA, GET_WITH_METADATA_RESPONSE, GET_WITH_VERSION, GET_WITH_VERSION_RESPONSE, HOTROD_STRING_CHARSET, ILLEGAL_LIFECYCLE_STATE, ILLEGAL_OP_CODE, INFINITE_LIFESPAN, INFINITE_MAXIDLE, INVALID_ITERATION, INVALID_MAGIC_OR_MESSAGE_ID_STATUS, ITERATION_END_REQUEST, ITERATION_END_RESPONSE, ITERATION_NEXT_REQUEST, ITERATION_NEXT_RESPONSE, ITERATION_START_REQUEST, ITERATION_START_RESPONSE, KEY_DOES_NOT_EXIST_STATUS, NO_ERROR_STATUS, NO_ERROR_STATUS_COMPAT, NODE_SUSPECTED, NOT_EXECUTED_WITH_PREVIOUS, NOT_EXECUTED_WITH_PREVIOUS_COMPAT, NOT_PUT_REMOVED_REPLACED_STATUS, PING_REQUEST, PING_RESPONSE, PREPARE_REQUEST, PREPARE_RESPONSE, PUT_ALL_REQUEST, PUT_ALL_RESPONSE, PUT_IF_ABSENT_REQUEST, PUT_IF_ABSENT_RESPONSE, PUT_REQUEST, PUT_RESPONSE, PUT_STREAM_REQUEST, PUT_STREAM_RESPONSE, QUERY_REQUEST, QUERY_RESPONSE, REMOVE_CLIENT_LISTENER_REQUEST, REMOVE_CLIENT_LISTENER_RESPONSE, REMOVE_IF_UNMODIFIED_REQUEST, REMOVE_IF_UNMODIFIED_RESPONSE, REMOVE_REQUEST, REMOVE_RESPONSE, REPLACE_IF_UNMODIFIED_REQUEST, REPLACE_IF_UNMODIFIED_RESPONSE, REPLACE_REQUEST, REPLACE_RESPONSE, REQUEST_MAGIC, REQUEST_PARSING_ERROR_STATUS, RESPONSE_MAGIC, ROLLBACK_REQUEST, ROLLBACK_RESPONSE, SERVER_ERROR_STATUS, SIZE_REQUEST, SIZE_RESPONSE, STATS_REQUEST, STATS_RESPONSE, SUCCESS_WITH_PREVIOUS, SUCCESS_WITH_PREVIOUS_COMPAT, SWITCH_CLUSTER_TOPOLOGY, UNKNOWN_COMMAND_STATUS, UNKNOWN_VERSION_STATUS, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_20, VERSION_21, VERSION_22, VERSION_23, VERSION_24, VERSION_25, VERSION_26, VERSION_27, VERSION_28
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RetryOnFailureOperation(short requestCode, short responseCode, Codec codec, ChannelFactory channelFactory, byte[] cacheName, AtomicInteger topologyId, int flags, Configuration cfg, DataFormat dataFormat)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cancel(SocketAddress address, Throwable cause)
Invoked when the callback cannot be invoked due to timeout or terminated pool.void
channelInactive(io.netty.channel.Channel channel)
void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
CompletableFuture<T>
execute()
protected abstract void
executeOperation(io.netty.channel.Channel channel)
protected void
fetchChannelAndInvoke(int retryCount, Set<SocketAddress> failedServers)
protected Throwable
handleException(Throwable cause, io.netty.channel.ChannelHandlerContext ctx, SocketAddress address)
void
invoke(io.netty.channel.Channel channel)
Invoked on an active channel ready to be writtenprotected void
logAndRetryOrFail(Throwable e, boolean canSwitchCluster)
protected void
reset()
-
Methods inherited from class org.infinispan.client.hotrod.impl.operations.HotRodOperation
acceptResponse, addParams, complete, header, releaseChannel, run, scheduleRead, scheduleTimeout, sendArrayOperation, sendHeader, sendHeaderAndRead, toString
-
Methods inherited from class java.util.concurrent.CompletableFuture
acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, cancel, completeAsync, completeAsync, completedFuture, completedStage, completeExceptionally, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, whenComplete, whenCompleteAsync, whenCompleteAsync
-
-
-
-
Field Detail
-
log
protected static final Log log
-
trace
protected static final boolean trace
-
-
Constructor Detail
-
RetryOnFailureOperation
protected RetryOnFailureOperation(short requestCode, short responseCode, Codec codec, ChannelFactory channelFactory, byte[] cacheName, AtomicInteger topologyId, int flags, Configuration cfg, DataFormat dataFormat)
-
-
Method Detail
-
execute
public CompletableFuture<T> execute()
- Specified by:
execute
in classHotRodOperation<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 interfaceChannelOperation
-
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 interfaceChannelOperation
-
reset
protected void reset()
-
channelInactive
public void channelInactive(io.netty.channel.Channel channel)
- Overrides:
channelInactive
in classHotRodOperation<T>
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
- Overrides:
exceptionCaught
in classHotRodOperation<T>
-
handleException
protected Throwable handleException(Throwable cause, io.netty.channel.ChannelHandlerContext ctx, SocketAddress address)
-
logAndRetryOrFail
protected void logAndRetryOrFail(Throwable e, boolean canSwitchCluster)
-
fetchChannelAndInvoke
protected void fetchChannelAndInvoke(int retryCount, Set<SocketAddress> failedServers)
-
executeOperation
protected abstract void executeOperation(io.netty.channel.Channel channel)
-
-