Package com.contentstack.sdk
Enum RetryOptions.BackoffStrategy
- java.lang.Object
-
- java.lang.Enum<RetryOptions.BackoffStrategy>
-
- com.contentstack.sdk.RetryOptions.BackoffStrategy
-
- All Implemented Interfaces:
Serializable,Comparable<RetryOptions.BackoffStrategy>
- Enclosing class:
- RetryOptions
public static enum RetryOptions.BackoffStrategy extends Enum<RetryOptions.BackoffStrategy>
Defines how delay between retries is calculated.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CUSTOMCustom backoff strategy - delay is calculated by the user.EXPONENTIALExponential backoff - delay doubles with each attempt.FIXEDFixed delay - same wait time for each retry.LINEARLinear backoff - delay increases linearly with attempt number.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RetryOptions.BackoffStrategyvalueOf(String name)Returns the enum constant of this type with the specified name.static RetryOptions.BackoffStrategy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FIXED
public static final RetryOptions.BackoffStrategy FIXED
Fixed delay - same wait time for each retry.Example with 1000ms base delay:
- Attempt 1: 1000ms
- Attempt 2: 1000ms
- Attempt 3: 1000ms
-
LINEAR
public static final RetryOptions.BackoffStrategy LINEAR
Linear backoff - delay increases linearly with attempt number.Example with 1000ms base delay:
- Attempt 1: 1000ms (1 × 1000)
- Attempt 2: 2000ms (2 × 1000)
- Attempt 3: 3000ms (3 × 1000)
-
EXPONENTIAL
public static final RetryOptions.BackoffStrategy EXPONENTIAL
Exponential backoff - delay doubles with each attempt.Example with 1000ms base delay:
- Attempt 1: 1000ms (2⁰ × 1000)
- Attempt 2: 2000ms (2¹ × 1000)
- Attempt 3: 4000ms (2² × 1000)
Recommended for most use cases as it quickly backs off to prevent overwhelming the server while allowing fast recovery.
-
CUSTOM
public static final RetryOptions.BackoffStrategy CUSTOM
Custom backoff strategy - delay is calculated by the user.Example with 1000ms base delay:
- Attempt 1: 1000ms
- Attempt 2: 2000ms
- Attempt 3: 3000ms
-
-
Method Detail
-
values
public static RetryOptions.BackoffStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (RetryOptions.BackoffStrategy c : RetryOptions.BackoffStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RetryOptions.BackoffStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
-