Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
import java.util.concurrent.ThreadLocalRandom;

/**
* An utility class for keeping the parameters and providing the value of exponential
* A utility class for keeping the parameters and providing the value of exponential
* retry backoff, exponential reconnect backoff, exponential timeout, etc.
* <p>
* The formula is:
* Backoff(attempts) = random(1 - jitter, 1 + jitter) * initialInterval * multiplier ^ attempts
* If initialInterval is greater or equal than maxInterval, a constant backoff of will be provided
* This class is thread-safe
* <pre>Backoff(attempts) = random(1 - jitter, 1 + jitter) * initialInterval * multiplier ^ attempts</pre>
* If {@code initialInterval} is greater than or equal to {@code maxInterval}, a constant backoff of
* {@code initialInterval} will be provided.
* <p>
* This class is thread-safe.
*/
public class ExponentialBackoff {
private final int multiplier;
Expand Down