Package com.castlabs.android.network
Class RetryConfiguration.Builder
java.lang.Object
com.castlabs.android.network.RetryConfiguration.Builder
- Enclosing class:
RetryConfiguration
Use this builder to create new instances of the retry configuration
-
Constructor Summary
ConstructorDescriptionBuilder()
Builder
(RetryConfiguration source) Create a new builder that will take its initial values from the given source -
Method Summary
Modifier and TypeMethodDescriptionbackoffFactor
(float value) Sets the backoff factor.baseDelayMs
(int value) Sets the base delay in milliseconds.fuzzFactor
(float value) Sets the fuzzy factor.get()
Create the configuration instancemaxAttempts
(int value) Sets the number of total attempts permitted by the configuration.maxDelayMs
(long value) Sets the maximum delay permitted by the configurationretryCodes
(int[] retryCodes) Sets error codes triggering retries Note: currently implemented for DRM requests only andDrmTodayException
error codesretryExceptions
(List<Class<? extends Exception>> retryExceptions) Sets Exceptions triggering retries Note: currently implemented for DRM requests only
-
Constructor Details
-
Builder
public Builder() -
Builder
Create a new builder that will take its initial values from the given source- Parameters:
source
- The source
-
-
Method Details
-
maxAttempts
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
Sets the base delay in milliseconds.- Parameters:
value
- The value- Returns:
- The builder
-
backoffFactor
Sets the backoff factor.- Parameters:
value
- The value- Returns:
- The builder
-
fuzzFactor
Sets the fuzzy factor.- Parameters:
value
- The value- Returns:
- The builder
-
maxDelayMs
Sets the maximum delay permitted by the configuration- Parameters:
value
- The value- Returns:
- The builder
-
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
Create the configuration instance- Returns:
- The configuration instance
-