Annotation Interface BackOff
BackOff
instance as part of a RetryPolicy
. Values can be provided as is or using a
*String
equivalent that supports more format, as well as expression evaluations.
The available attributes lead to the following:
- With no explicit settings, the default is a
FixedBackOff
with a delay of 1000L ms - With only
delay()
set: a fixed delay back off with that value - In all other cases, an
ExponentialBackOff
is created with the values ofdelay()
(default: 1000L ms),maxDelay()
(default: no maximum),multiplier()
(default: 1.0) andjitter()
(default: no jitter).
- Since:
- 4.0
- Author:
- Dave Syer, Gary Russell, Aftab Shaikh, Stephane Nicoll
-
Field Summary
Fields -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionlong
Specify the base delay after the initial invocation.Specify the base delay after the initial invocation using a String format.long
Specify a jitter value for the base retry attempt, randomly subtracted or added to the calculated delay, resulting in a value betweendelay - jitter
anddelay + jitter
but never below the base delay or above the max delay.Specify a jitter value for the base retry attempt using a String format.long
Specify the maximum delay for any retry attempt, limiting how far jitter and the multiplier can increase the delay.Specify the maximum delay for any retry attempt using a String format.double
Specify a multiplier for a delay for the next retry attempt using a String format.long
Alias fordelay()
.
-
Field Details
-
DEFAULT_DELAY
-
-
Element Details
-
value
-
delay
Specify the base delay after the initial invocation.If only a
delay
is specified, aFixedBackOff
with that value as the interval is configured.If a multiplier is specified, this serves as the initial delay to multiply from.
The default is 1000L milliseconds.
- Returns:
- the based delay in milliseconds (default1000L)
- Default:
1000L
-
delayString
String delayStringSpecify the base delay after the initial invocation using a String format. If this is specified, takes precedence overdelay()
.The delay String can be in several formats:
- a plain long — which is interpreted to represent a duration in milliseconds
- any of the known
DurationFormat.Style
: theISO8601
style or theSIMPLE
style — using milliseconds as fallback if the string doesn't contain an explicit unit - Regular expressions, such as
${example.property}
to use theexample.property
from the environment
- Returns:
- the based delay as a String value — for example a placeholder
- See Also:
- Default:
""
-
maxDelay
long maxDelaySpecify the maximum delay for any retry attempt, limiting how far jitter and the multiplier can increase the delay.Ignored if only
delay()
is set, otherwise anExponentialBackOff
with the given max delay or an unlimited delay if not set.- Returns:
- the maximum delay
- Default:
0L
-
maxDelayString
String maxDelayStringSpecify the maximum delay for any retry attempt using a String format. If this is specified, takes precedence overmaxDelay()
..The max delay String can be in several formats:
- a plain long — which is interpreted to represent a duration in milliseconds
- any of the known
DurationFormat.Style
: theISO8601
style or theSIMPLE
style — using milliseconds as fallback if the string doesn't contain an explicit unit - Regular expressions, such as
${example.property}
to use theexample.property
from the environment
- Returns:
- the max delay as a String value — for example a placeholder
- See Also:
- Default:
""
-
multiplier
double multiplierSpecify a multiplier for a delay for the next retry attempt, applied to the previous delay, starting with the initial delay as well as to the applicable jitter for each attempt.Ignored if only
delay()
is set, otherwise anExponentialBackOff
with the given multiplier or1.0
if not set.- Returns:
- the value to multiply the current interval by for each attempt
- Default:
0.0
-
multiplierString
String multiplierStringSpecify a multiplier for a delay for the next retry attempt using a String format. If this is specified, takes precedence overmultiplier()
.The multiplier String can be in several formats:
- a plain double
- Regular expressions, such as
${example.property}
to use theexample.property
from the environment
- Returns:
- the value to multiply the current interval by for each attempt — for example, a placeholder
- See Also:
- Default:
""
-
jitter
long jitterSpecify a jitter value for the base retry attempt, randomly subtracted or added to the calculated delay, resulting in a value betweendelay - jitter
anddelay + jitter
but never below the base delay or above the max delay.If a multiplier is specified, it is applied to the jitter value as well.
Ignored if only
delay()
is set, otherwise anExponentialBackOff
with the given jitter or no jitter if not set.- Returns:
- the jitter value in milliseconds
- See Also:
- Default:
0L
-
jitterString
String jitterStringSpecify a jitter value for the base retry attempt using a String format. If this is specified, takes precedence overjitter()
.The jitter String can be in several formats:
- a plain long — which is interpreted to represent a duration in milliseconds
- any of the known
DurationFormat.Style
: theISO8601
style or theSIMPLE
style — using milliseconds as fallback if the string doesn't contain an explicit unit - Regular expressions, such as
${example.property}
to use theexample.property
from the environment
- Returns:
- the jitter as a String value — for example, a placeholder
- See Also:
- Default:
""
-