Package com.styra.opa.openapi.utils
Class BackoffStrategy.Builder
- java.lang.Object
-
- com.styra.opa.openapi.utils.BackoffStrategy.Builder
-
- Enclosing class:
- BackoffStrategy
public static final class BackoffStrategy.Builder extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BackoffStrategy.Builder
baseFactor(double baseFactor)
Sets the backoff base factor.BackoffStrategy
build()
BackoffStrategy.Builder
exponent(double baseFactor)
Deprecated.usebaseFactor(double)
instead.BackoffStrategy.Builder
initialInterval(long duration, java.util.concurrent.TimeUnit unit)
Sets the initial intervalBackoffStrategy.Builder
jitterFactor(double jitterFactor)
Sets the jitter factor used to randomize the backoff interval.BackoffStrategy.Builder
maxElapsedTime(long duration, java.util.concurrent.TimeUnit unit)
Sets the maximum elapsed timeBackoffStrategy.Builder
maxInterval(long duration, java.util.concurrent.TimeUnit unit)
Sets the maximum intervalBackoffStrategy.Builder
retryConnectError(boolean retry)
Specifies whether connection errors should be retried.BackoffStrategy.Builder
retryReadTimeoutError(boolean retry)
Specifies whether Read Timeout errors should be retried.BackoffStrategy.Builder
throwConnectError()
Do not retry on connection error.BackoffStrategy.Builder
throwReadTimeoutError()
Do not retry on Read Timeout error.
-
-
-
Method Detail
-
initialInterval
public BackoffStrategy.Builder initialInterval(long duration, java.util.concurrent.TimeUnit unit)
Sets the initial interval- Parameters:
duration
- The initial interval.unit
- The time unit associated with duration.- Returns:
- The builder instance.
-
maxInterval
public BackoffStrategy.Builder maxInterval(long duration, java.util.concurrent.TimeUnit unit)
Sets the maximum interval- Parameters:
duration
- The maximum interval.unit
- The time unit associated with duration.- Returns:
- The builder instance.
-
maxElapsedTime
public BackoffStrategy.Builder maxElapsedTime(long duration, java.util.concurrent.TimeUnit unit)
Sets the maximum elapsed time- Parameters:
duration
- The maximum elapsed time.unit
- The time unit associated with duration.- Returns:
- The builder instance.
-
baseFactor
public BackoffStrategy.Builder baseFactor(double baseFactor)
Sets the backoff base factor.- Parameters:
baseFactor
- The base factor to use.- Returns:
- The builder instance.
-
exponent
@Deprecated public BackoffStrategy.Builder exponent(double baseFactor)
Deprecated.usebaseFactor(double)
instead.Sets the backoff base factor.- Parameters:
baseFactor
- The base factor to use.- Returns:
- The builder instance.
-
jitterFactor
public BackoffStrategy.Builder jitterFactor(double jitterFactor)
Sets the jitter factor used to randomize the backoff interval.- Parameters:
jitterFactor
- The jitter factor to use (default is 0.5f).- Returns:
- The builder instance.
-
retryConnectError
public BackoffStrategy.Builder retryConnectError(boolean retry)
Specifies whether connection errors should be retried.- Parameters:
retry
- Whether to retry on connection error.- Returns:
- The builder instance.
-
throwConnectError
public BackoffStrategy.Builder throwConnectError()
Do not retry on connection error.- Returns:
- The builder instance.
-
retryReadTimeoutError
public BackoffStrategy.Builder retryReadTimeoutError(boolean retry)
Specifies whether Read Timeout errors should be retried.- Parameters:
retry
- Whether to retry on Read Timeout error.- Returns:
- The builder instance.
-
throwReadTimeoutError
public BackoffStrategy.Builder throwReadTimeoutError()
Do not retry on Read Timeout error.- Returns:
- The builder instance.
-
build
public BackoffStrategy build()
-
-