Package com.castlabs.android.network
Class RetryConfiguration.Builder
- java.lang.Object
-
- com.castlabs.android.network.RetryConfiguration.Builder
-
- Enclosing class:
- RetryConfiguration
public static class RetryConfiguration.Builder extends Object
Use this builder to create new instances of the retry configuration
-
-
Constructor Summary
Constructors Constructor Description Builder()
Builder(RetryConfiguration source)
Create a new builder that will take its initial values from the given source
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RetryConfiguration.Builder
backoffFactor(float value)
Sets the backoff factor.RetryConfiguration.Builder
baseDelayMs(int value)
Sets the base delay in milliseconds.RetryConfiguration.Builder
fuzzFactor(float value)
Sets the fuzzy factor.RetryConfiguration
get()
Create the configuration instanceRetryConfiguration.Builder
maxAttempts(int value)
Sets the number of total attempts permitted by the configuration.RetryConfiguration.Builder
maxDelayMs(long value)
Sets the maximum delay permitted by the configurationRetryConfiguration.Builder
retryCodes(int[] retryCodes)
Sets error codes triggering retries Note: currently implemented for DRM requests only andDrmTodayException
error codesRetryConfiguration.Builder
retryExceptions(List<Class<? extends Exception>> retryExceptions)
Sets Exceptions triggering retries Note: currently implemented for DRM requests only
-
-
-
Constructor Detail
-
Builder
public Builder()
-
Builder
public Builder(RetryConfiguration source)
Create a new builder that will take its initial values from the given source- Parameters:
source
- The source
-
-
Method Detail
-
maxAttempts
public RetryConfiguration.Builder maxAttempts(int value)
Sets the number of total attempts permitted by the configuration. This covers the initial attempts as well as all retries. For example, setting this to 3 will permit at most three attempts, the initial request and at most two retries.- Parameters:
value
- The value- Returns:
- The builder
-
baseDelayMs
public RetryConfiguration.Builder baseDelayMs(int value)
Sets the base delay in milliseconds.- Parameters:
value
- The value- Returns:
- The builder
-
backoffFactor
public RetryConfiguration.Builder backoffFactor(float value)
Sets the backoff factor.- Parameters:
value
- The value- Returns:
- The builder
-
fuzzFactor
public RetryConfiguration.Builder fuzzFactor(float value)
Sets the fuzzy factor.- Parameters:
value
- The value- Returns:
- The builder
-
maxDelayMs
public RetryConfiguration.Builder maxDelayMs(long value)
Sets the maximum delay permitted by the configuration- Parameters:
value
- The value- Returns:
- The builder
-
retryCodes
public RetryConfiguration.Builder retryCodes(@Nullable int[] retryCodes)
Sets error codes triggering retries Note: currently implemented for DRM requests only andDrmTodayException
error codes- Parameters:
retryCodes
- The error codes- Returns:
- The builder
-
retryExceptions
public RetryConfiguration.Builder retryExceptions(@Nullable List<Class<? extends Exception>> retryExceptions)
Sets Exceptions triggering retries Note: currently implemented for DRM requests only- Parameters:
retryExceptions
- The Exception classes- Returns:
- The builder
-
get
public RetryConfiguration get()
Create the configuration instance- Returns:
- The configuration instance
-
-