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(RetryRuleWithContent<RpcResponse> retryRuleWithContent)
Returns a newRetryingRpcClientBuilder
with the specifiedRetryRuleWithContent
.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(RetryRuleWithContent<RpcResponse> retryRuleWithContent)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts)
Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.static Function<? super RpcClient,RetryingRpcClient>
newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, 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, retryRule, retryRuleWithContent, scheduleNextRetry, setResponseTimeout
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap
-
Method Details
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rule
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rulemaxTotalAttempts
- the maximum number of total attempts
-
newDecorator
public static Function<? super RpcClient,RetryingRpcClient> newDecorator(RetryRuleWithContent<RpcResponse> retryRuleWithContent, int maxTotalAttempts, long responseTimeoutMillisForEachAttempt)Creates a newRpcClient
decorator that handles failures of an invocation and retries RPC requests.- Parameters:
retryRuleWithContent
- the retry rulemaxTotalAttempts
- the maximum number of total attemptsresponseTimeoutMillisForEachAttempt
- response timeout for each attempt.0
disables the timeout
-
builder
public static RetryingRpcClientBuilder builder(RetryRuleWithContent<RpcResponse> retryRuleWithContent)Returns a newRetryingRpcClientBuilder
with the specifiedRetryRuleWithContent
. -
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
-