Package com.guinetik.rr.interceptor
Class RetryInterceptor.Builder
- java.lang.Object
-
- com.guinetik.rr.interceptor.RetryInterceptor.Builder
-
- Enclosing class:
- RetryInterceptor
public static class RetryInterceptor.Builder extends Object
Builder for creating customized RetryInterceptor instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RetryInterceptor.BuilderbackoffMultiplier(double multiplier)Sets the backoff multiplier for exponential backoff.RetryInterceptorbuild()Builds the RetryInterceptor with configured settings.RetryInterceptor.BuilderinitialDelayMs(long initialDelayMs)Sets the initial delay between retries.RetryInterceptor.BuildermaxDelayMs(long maxDelayMs)Sets the maximum delay cap.RetryInterceptor.BuildermaxRetries(int maxRetries)Sets the maximum number of retries.RetryInterceptor.BuilderretryOn(Predicate<RocketRestException> predicate)Sets a custom predicate to determine if an exception should trigger retry.
-
-
-
Method Detail
-
maxRetries
public RetryInterceptor.Builder maxRetries(int maxRetries)
Sets the maximum number of retries.- Parameters:
maxRetries- Maximum retries (must be non-negative)- Returns:
- This builder
-
initialDelayMs
public RetryInterceptor.Builder initialDelayMs(long initialDelayMs)
Sets the initial delay between retries.- Parameters:
initialDelayMs- Delay in milliseconds- Returns:
- This builder
-
backoffMultiplier
public RetryInterceptor.Builder backoffMultiplier(double multiplier)
Sets the backoff multiplier for exponential backoff.- Parameters:
multiplier- Multiplier (must be >= 1.0)- Returns:
- This builder
-
maxDelayMs
public RetryInterceptor.Builder maxDelayMs(long maxDelayMs)
Sets the maximum delay cap.- Parameters:
maxDelayMs- Maximum delay in milliseconds- Returns:
- This builder
-
retryOn
public RetryInterceptor.Builder retryOn(Predicate<RocketRestException> predicate)
Sets a custom predicate to determine if an exception should trigger retry.- Parameters:
predicate- The retry predicate- Returns:
- This builder
-
build
public RetryInterceptor build()
Builds the RetryInterceptor with configured settings.- Returns:
- A new RetryInterceptor instance
-
-