Class RetryingRpcClient
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Client<T_I,T_O>>
com.linecorp.armeria.client.DecoratingClient<I,O,I,O>
com.linecorp.armeria.client.SimpleDecoratingClient<I,O>
com.linecorp.armeria.client.retry.AbstractRetryingClient<RpcRequest,RpcResponse>
com.linecorp.armeria.client.retry.RetryingRpcClient
- All Implemented Interfaces:
Client<RpcRequest,RpcResponse>
,RpcClient
,Unwrappable
public final class RetryingRpcClient extends AbstractRetryingClient<RpcRequest,RpcResponse> implements RpcClient
An
RpcClient
decorator that handles failures of an invocation and retries RPC requests.-
Field Summary
Fields inherited from class com.linecorp.armeria.client.retry.AbstractRetryingClient
ARMERIA_RETRY_COUNT
-
Method Summary
Modifier and Type Method Description static RetryingRpcClientBuilder
builder(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent)
Returns a newRetryingRpcClientBuilder
with the specifiedRetryStrategyWithContent
.protected RpcResponse
doExecute(ClientRequestContext ctx, RpcRequest req)
Invoked byAbstractRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent, int maxTotalAttempts)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.Methods inherited from class com.linecorp.armeria.client.retry.AbstractRetryingClient
execute, getNextDelay, getNextDelay, getTotalAttempts, newDerivedContext, onRetryingComplete, retryStrategy, retryStrategyWithContent, scheduleNextRetry, setResponseTimeout
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, delegate, toString
-
Method Details
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryStrategyWithContent
- the retry strategy
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent, int maxTotalAttempts)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryStrategyWithContent
- the retry strategymaxTotalAttempts
- the maximum number of total attempts
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryStrategyWithContent
- the retry strategymaxTotalAttempts
- the maximum number of total attemptsresponseTimeoutMillisForEachAttempt
- response timeout for each attempt.0
disables the timeout
-
builder
public static RetryingRpcClientBuilder builder(RetryStrategyWithContent<RpcResponse> retryStrategyWithContent)Returns a newRetryingRpcClientBuilder
with the specifiedRetryStrategyWithContent
. -
doExecute
Description copied from class:AbstractRetryingClient
Invoked byAbstractRetryingClient.execute(ClientRequestContext, Request)
after the deadline for response timeout is set.- Specified by:
doExecute
in classAbstractRetryingClient<RpcRequest,RpcResponse>
- Throws:
Exception
-