Package org.apache.sling.distribution.journal.shared

# Class ExponentialBackOff

java.lang.Object
org.apache.sling.distribution.journal.shared.ExponentialBackOff

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class ExponentialBackOff extends Object implements Closeable
Retry with exponential backoff. Calls checkCallback until it does not throw an Exception. Retries are first done with startDelay, then doubled until maxDelay is reached.

## Constructor Summary

Constructors
Constructor
Description
`ExponentialBackOff(long startDelay, long maxDelay, boolean randomDelay, Runnable checkCallback)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`startChecks()`

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

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

## Constructor Details

### ExponentialBackOff

public ExponentialBackOff(long startDelay, long maxDelay, boolean randomDelay, Runnable checkCallback)

Parameters:
  `startDelay` - the start delay in milliseconds
  `maxDelay` - the max delay in milliseconds
  `randomDelay` - `true` to randomise the delay between 0 and the current max delay ; `false` to use the current max delay.
  `checkCallback` - the code to invoke when the current delay has elapsed

## Method Details

### close

public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`

### startChecks

public void startChecks()