Annotation Interface Backoff
Collects metadata for a
BackOffPolicy
. Features:
- With no explicit settings the default is a fixed delay of 1000ms
- Only the
delay()
set: the backoff is a fixed delay with that value - When
delay()
andmaxDelay()
are set the backoff is uniformly distributed between the two values - With
delay()
,maxDelay()
andmultiplier()
the backoff is exponentially growing up to the maximum value - If, in addition, the
random()
flag is set then the multiplier is chosen for each delay from a uniform distribution in [1, multiplier-1]
- Since:
- 1.1
- Author:
- Dave Syer, Gary Russell, Aftab Shaikh
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionlong
A canonical backoff period.An expression evaluating to the canonical backoff period.long
The maximum wait (in milliseconds) between retries.An expression evaluating to the maximum wait (in milliseconds) between retries.double
If greater than 1.0, used as a multiplier for generating the next delay for backoff; any value less than or equal to 1.0 is treated as 1.0, meaning a fixed delay.Evaluates to a value used as a multiplier for generating the next delay for backoff; ; any value less than or equal to 1.0 is treated as 1.0, meaning a fixed delay.boolean
In the exponential case (multiplier()
> 1.0) set this to true to have the backoff delays randomized with jitter, so that the maximum delay is multiplier times the previous delay and the distribution is uniform between the two values.Evaluates to a value.long
Synonym fordelay()
.
-
Element Details
-
value
@AliasFor("delay") long valueSynonym fordelay()
. Whendelay()
is non-zero, value of this element is ignored, otherwise value of this element is taken.- Returns:
- the delay in milliseconds (default 1000)
- Default:
- 1000L
-
delay
@AliasFor("value") long delayA canonical backoff period. Used as an initial value in the exponential case, and as a minimum value in the uniform case. When the value of this element is 0, value of elementvalue()
is taken, otherwise value of this element is taken andvalue()
is ignored.- Returns:
- the initial or canonical backoff period in milliseconds (default 1000)
- Default:
- 1000L
-
maxDelay
long maxDelayThe maximum wait (in milliseconds) between retries. If less than thedelay()
then the default of 30000L is applied.- Returns:
- the maximum delay between retries (default 0 = ignored)
- Default:
- 0L
-
multiplier
double multiplierIf greater than 1.0, used as a multiplier for generating the next delay for backoff; any value less than or equal to 1.0 is treated as 1.0, meaning a fixed delay.- Returns:
- a multiplier to use to calculate the next backoff delay (default 0 = ignored)
- Default:
- 0.0
-
delayExpression
String delayExpressionAn expression evaluating to the canonical backoff period. Used as an initial value in the exponential case, and as a minimum value in the uniform case. Overridesdelay()
. Use#{...}
for one-time evaluation during initialization, omit the delimiters for evaluation at runtime.- Returns:
- the initial or canonical backoff period in milliseconds.
- Since:
- 1.2
- Default:
- ""
-
maxDelayExpression
String maxDelayExpressionAn expression evaluating to the maximum wait (in milliseconds) between retries. If less than thedelay()
then the default of 30000L is applied. OverridesmaxDelay()
. Use#{...}
for one-time evaluation during initialization, omit the delimiters for evaluation at runtime.- Returns:
- the maximum delay between retries (default 0 = ignored)
- Since:
- 1.2
- Default:
- ""
-
multiplierExpression
String multiplierExpressionEvaluates to a value used as a multiplier for generating the next delay for backoff; ; any value less than or equal to 1.0 is treated as 1.0, meaning a fixed delay. Overridesmultiplier()
. Use#{...}
for one-time evaluation during initialization, omit the delimiters for evaluation at runtime.- Returns:
- a multiplier expression to use to calculate the next backoff delay (default 0 = ignored)
- Since:
- 1.2
- Default:
- ""
-
random
boolean randomIn the exponential case (multiplier()
> 1.0) set this to true to have the backoff delays randomized with jitter, so that the maximum delay is multiplier times the previous delay and the distribution is uniform between the two values.- Returns:
- the flag to signal randomization is required (default false)
- Default:
- false
-
randomExpression
String randomExpressionEvaluates to a value. In the exponential case (multiplier()
> 1.0) set this to true to have the backoff delays randomized, so that the maximum delay is multiplier times the previous delay and the distribution is uniform between the two values. This expression is always evaluated during initialization. If the expression returns true thenExponentialRandomBackOffPolicy
is used elseExponentialBackOffPolicy
is used.- Returns:
- the flag to signal randomization is required (default false)
- Default:
- ""
-