public static class EBRetryStrategyBackoff.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
EBRetryStrategyBackoff |
build()
Builds a new instance of
EBRetryStrategyBackoff . |
int |
getInitialIntervalMillis()
Returns the initial retry interval in milliseconds.
|
int |
getMaxAttempts()
Maximum number of attempts
|
int |
getMaxElapsedTimeMillis()
Returns the maximum elapsed time in milliseconds.
|
int |
getMaxIntervalMillis()
Returns the maximum value of the back off period in milliseconds.
|
double |
getMultiplier()
Returns the value to multiply the current interval with for each retry attempt.
|
double |
getRandomizationFactor()
Returns the randomization factor to use for creating a range around the retry interval.
|
EBRetryStrategyBackoff.Builder |
setInitialIntervalMillis(int initialIntervalMillis)
Sets the initial retry interval in milliseconds.
|
EBRetryStrategyBackoff.Builder |
setJSON(org.json.JSONObject json)
Reads serialized settings from the JSON
|
EBRetryStrategyBackoff.Builder |
setMaxAttempts(int maxAttempts)
Sets maximum number of attempts before quitting.
|
EBRetryStrategyBackoff.Builder |
setMaxElapsedTimeMillis(int maxElapsedTimeMillis)
Sets the maximum elapsed time in milliseconds.
|
EBRetryStrategyBackoff.Builder |
setMaxIntervalMillis(int maxIntervalMillis)
Sets the maximum value of the back off period in milliseconds.
|
EBRetryStrategyBackoff.Builder |
setMultiplier(double multiplier)
Sets the value to multiply the current interval with for each retry attempt.
|
EBRetryStrategyBackoff.Builder |
setRandomizationFactor(double randomizationFactor)
Sets the randomization factor to use for creating a range around the retry interval.
|
public EBRetryStrategyBackoff build()
EBRetryStrategyBackoff
.public final int getInitialIntervalMillis()
EBRetryStrategyBackoff.DEFAULT_INITIAL_INTERVAL_MILLIS
.public EBRetryStrategyBackoff.Builder setInitialIntervalMillis(int initialIntervalMillis)
EBRetryStrategyBackoff.DEFAULT_INITIAL_INTERVAL_MILLIS
. Must be > 0
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
initialIntervalMillis
- intpublic final double getRandomizationFactor()
EBRetryStrategyBackoff.DEFAULT_RANDOMIZATION_FACTOR
.
A randomization factor of 0.5 results in a random period ranging between 50% below and 50% above the retry interval.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public EBRetryStrategyBackoff.Builder setRandomizationFactor(double randomizationFactor)
EBRetryStrategyBackoff.DEFAULT_RANDOMIZATION_FACTOR
. Must fall in the range
0 <= randomizationFactor < 1
.
A randomization factor of 0.5 results in a random period ranging between 50% below and 50% above the retry interval.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
randomizationFactor
- doublepublic final double getMultiplier()
EBRetryStrategyBackoff.DEFAULT_MULTIPLIER
.public EBRetryStrategyBackoff.Builder setMultiplier(double multiplier)
EBRetryStrategyBackoff.DEFAULT_MULTIPLIER
. Must be >= 1
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
multiplier
- doublepublic final int getMaxIntervalMillis()
EBRetryStrategyBackoff.DEFAULT_MAX_INTERVAL_MILLIS
. Must be >= initialInterval
.public EBRetryStrategyBackoff.Builder setMaxIntervalMillis(int maxIntervalMillis)
EBRetryStrategyBackoff.DEFAULT_MAX_INTERVAL_MILLIS
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
maxIntervalMillis
- intpublic final int getMaxElapsedTimeMillis()
EBRetryStrategyBackoff.DEFAULT_MAX_ELAPSED_TIME_MILLIS
.
If the time elapsed since an EBRetryStrategyBackoff
instance is created goes past the
max_elapsed_time then the method EBRetryStrategyBackoff.nextBackOffMillis()
starts returning
BackOff.STOP
. The elapsed time can be reset by calling EBRetryStrategyBackoff.reset()
.
public EBRetryStrategyBackoff.Builder setMaxElapsedTimeMillis(int maxElapsedTimeMillis)
EBRetryStrategyBackoff.DEFAULT_MAX_ELAPSED_TIME_MILLIS
. Must be > 0
.
If the time elapsed since an EBRetryStrategyBackoff
instance is created goes past the
max_elapsed_time then the method EBRetryStrategyBackoff.nextBackOffMillis()
starts returning
BackOff.STOP
. The elapsed time can be reset by calling EBRetryStrategyBackoff.reset()
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
maxElapsedTimeMillis
- intpublic int getMaxAttempts()
public EBRetryStrategyBackoff.Builder setMaxAttempts(int maxAttempts)
EBRetryStrategyBackoff.DEFAULT_MAX_ATTEMPTS
. If is < 0
this limit is not taken into account.maxAttempts
- number of attemptspublic EBRetryStrategyBackoff.Builder setJSON(org.json.JSONObject json)
json
- json to useCopyright © 2016. All rights reserved.