Package com.shri.restinpeace
Class RetryConfig
java.lang.Object
com.shri.restinpeace.RetryConfig
Per-client default retry policy for
RIP.getClient(Class, RipClientConfig) -
applied to any call whose method has no @Retry of its own (and
whose interface has no interface-level @Retry default either -
see that annotation's own javadoc for the interface-level shape), for a
client whose retry policy is only known at runtime instead of fixed at
compile time (e.g. more aggressive retries against a known-flakier
staging environment than what the interface's own @Retry
annotations declare for production).
UserApi stagingApi = RIP.getClient(UserApi.class, RipClientConfig.builder()
.baseUrl(stagingBaseUrl)
.retry(RetryConfig.builder().times(5).delayMillis(500).build())
.build());
A method's own @Retry (or its interface's) always wins when
present - this is only the fallback for a method with neither, mirroring
the precedence @Timeout/RipClientConfig already establish
(method-level annotation beats the client-wide config).-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RetryConfig.Builderbuilder()Starts building a new retry config, defaulting to the exact same values@Retry's own annotation defaults use.doubleReturns the backoff multiplier.longReturns the initial retry delay.doubleReturns the jitter fraction.int[]Returns the retryable HTTP status codes.intgetTimes()Returns the maximum number of attempts.booleanReturns whether a stableIdempotency-Keyis sent.
-
Method Details
-
builder
Starts building a new retry config, defaulting to the exact same values@Retry's own annotation defaults use.- Returns:
- a new builder
-
getTimes
public int getTimes()Returns the maximum number of attempts.- Returns:
- the maximum number of attempts
-
getDelayMillis
public long getDelayMillis()Returns the initial retry delay.- Returns:
- the initial delay in milliseconds
-
getBackoffMultiplier
public double getBackoffMultiplier()Returns the backoff multiplier.- Returns:
- the backoff multiplier
-
getJitterFactor
public double getJitterFactor()Returns the jitter fraction.- Returns:
- the jitter fraction
-
getRetryOnStatus
public int[] getRetryOnStatus()Returns the retryable HTTP status codes.- Returns:
- the retryable status codes
-
isIdempotent
public boolean isIdempotent()Returns whether a stableIdempotency-Keyis sent.- Returns:
- whether to send a stable
Idempotency-Key
-