Package org.springframework.util.backoff

# Class FixedBackOff

java.lang.Object
org.springframework.util.backoff.FixedBackOff

All Implemented Interfaces:
  `BackOff`

public class FixedBackOff extends Object implements BackOff
A simple `BackOff` implementation that provides a fixed interval between two attempts and a maximum number of retries.

Since:
  4.1
Author:
  Stephane Nicoll

## Field Summary

Fields
Modifier and Type
Field
Description
`static final long`
`DEFAULT_INTERVAL`
The default recovery interval: 5000 ms = 5 seconds.
`static final long`
`UNLIMITED_ATTEMPTS`
Constant value indicating an unlimited number of attempts.

## Constructor Summary

Constructors
Constructor
Description
`FixedBackOff()`
Create an instance with an interval of 5000L ms and an unlimited number of attempts.
`FixedBackOff(long interval, long maxAttempts)`
Create an instance.

## Method Summary

Modifier and Type
Method
Description
`long`
`getInterval()`
Return the interval between two attempts in milliseconds.
`long`
`getMaxAttempts()`
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.
`BackOffExecution`
`start()`
Start a new back off execution.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### DEFAULT_INTERVAL

public static final long DEFAULT_INTERVAL
The default recovery interval: 5000 ms = 5 seconds.

See Also:
  - Constant Field Values

### UNLIMITED_ATTEMPTS

public static final long UNLIMITED_ATTEMPTS
Constant value indicating an unlimited number of attempts.

See Also:
  - Constant Field Values

## Constructor Details

### FixedBackOff

public FixedBackOff()
Create an instance with an interval of 5000L ms and an unlimited number of attempts.

### FixedBackOff

public FixedBackOff(long interval, long maxAttempts)
Create an instance.

Parameters:
  `interval` - the interval between two attempts
  `maxAttempts` - 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

public BackOffExecution start()
Description copied from interface: `BackOff`
Start a new back off execution.

Specified by:
  `start` in interface `BackOff`
Returns:
  a fresh `BackOffExecution` ready to be used