Class FixedBackOff
java.lang.Object
org.springframework.util.backoff.FixedBackOff
- All Implemented Interfaces:
BackOff
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
The default recovery interval: 5000 ms = 5 seconds.static final long
Constant value indicating an unlimited number of attempts. -
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance with an interval of 5000L ms and an unlimited number of attempts.FixedBackOff
(long interval) Create an instance with the supplied interval and an unlimited number of attempts.FixedBackOff
(long interval, long maxAttempts) Create an instance with the supplied interval and maximum number of attempts.FixedBackOff
(Duration interval) Create an instance with the supplied interval and an unlimited number of attempts. -
Method Summary
Modifier and TypeMethodDescriptionlong
Return the interval between two attempts in milliseconds.long
Return the maximum number of attempts in milliseconds.void
setInterval
(long interval) Set the interval between two attempts in milliseconds.void
setMaxAttempts
(long maxAttempts) Set the maximum number of attempts in milliseconds.start()
Start a new back off execution.
-
Field Details
-
DEFAULT_INTERVAL
public static final long DEFAULT_INTERVALThe default recovery interval: 5000 ms = 5 seconds.- See Also:
-
UNLIMITED_ATTEMPTS
public static final long UNLIMITED_ATTEMPTSConstant value indicating an unlimited number of attempts.- See Also:
-
-
Constructor Details
-
FixedBackOff
public FixedBackOff()Create an instance with an interval of 5000L ms and an unlimited number of attempts.- See Also:
-
FixedBackOff
public FixedBackOff(long interval) Create an instance with the supplied interval and an unlimited number of attempts.- Parameters:
interval
- the interval between two attempts in milliseconds- Since:
- 7.0
- See Also:
-
FixedBackOff
Create an instance with the supplied interval and an unlimited number of attempts.- Parameters:
interval
- the interval between two attempts- Since:
- 7.0
- See Also:
-
FixedBackOff
public FixedBackOff(long interval, long maxAttempts) Create an instance with the supplied interval and maximum number of attempts.- Parameters:
interval
- the interval between two attempts in millisecondsmaxAttempts
- the maximum number of attempts
-
-
Method Details
-
setInterval
public void setInterval(long interval) Set the interval between two attempts in milliseconds. -
getInterval
public long getInterval()Return the interval between two attempts in milliseconds. -
setMaxAttempts
public void setMaxAttempts(long maxAttempts) Set the maximum number of attempts in milliseconds. -
getMaxAttempts
public long getMaxAttempts()Return the maximum number of attempts in milliseconds. -
start
Description copied from interface:BackOff
Start a new back off execution.- Specified by:
start
in interfaceBackOff
- Returns:
- a fresh
BackOffExecution
ready to be used
-