Package growthbook.sdk.java.retry
Class FeatureFetchRetryPolicy
java.lang.Object
growthbook.sdk.java.retry.FeatureFetchRetryPolicy
Configures bounded exponential backoff for feature fetch requests.
The default policy allows five total attempts. Delays are calculated before each retry, so the default five attempts produce retry waits of 1s, 2s, 4s, and 8s. The 16s default maximum delay caps custom policies with more attempts.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFeatureFetchRetryPolicy(int maxAttempts, Duration initialDelay, Duration maxDelay) Creates an exponential backoff policy. -
Method Summary
Modifier and TypeMethodDescriptionlonggetDelayMillisBeforeAttempt(int attemptNumber) Returns the delay before the requested attempt number.int
-
Field Details
-
DEFAULT_MAX_ATTEMPTS
public static final int DEFAULT_MAX_ATTEMPTS- See Also:
-
DEFAULT_MAX_DELAY
-
DEFAULT_INITIAL_DELAY
-
-
Constructor Details
-
FeatureFetchRetryPolicy
public FeatureFetchRetryPolicy() -
FeatureFetchRetryPolicy
Creates an exponential backoff policy.- Parameters:
maxAttempts- total attempts, including the first attemptinitialDelay- delay before the first retrymaxDelay- upper bound for any retry delay
-
-
Method Details
-
getDelayMillisBeforeAttempt
public long getDelayMillisBeforeAttempt(int attemptNumber) Returns the delay before the requested attempt number.- Parameters:
attemptNumber- one-based attempt number- Returns:
- zero for the first attempt, otherwise the capped exponential delay
-
getMaxAttempts
public int getMaxAttempts() -
getMaxDelay
-
getInitialDelay
-