Class ExponentialBackOff
java.lang.Object
org.apache.sling.distribution.journal.shared.ExponentialBackOff
- All Implemented Interfaces:
Closeable
,AutoCloseable
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
ConstructorsConstructorDescriptionExponentialBackOff
(long startDelay, long maxDelay, boolean randomDelay, Runnable checkCallback) -
Method Summary
-
Constructor Details
-
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 Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
startChecks
public void startChecks()
-