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)
-
-
-
Constructor Detail
-
ExponentialBackOff
public ExponentialBackOff(long startDelay, long maxDelay, boolean randomDelay, Runnable checkCallback)
- Parameters:
startDelay
- the start delay in millisecondsmaxDelay
- the max delay in millisecondsrandomDelay
-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 Detail
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
startChecks
public void startChecks()
-
-