Class RetryConfig

java.lang.Object
com.shri.restinpeace.RetryConfig

public final class RetryConfig extends Object
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).
  • Method Details

    • builder

      public static RetryConfig.Builder 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 stable Idempotency-Key is sent.
      Returns:
      whether to send a stable Idempotency-Key