Package ratpack.exec.util.retry
Interface RetryPolicy
-
- All Known Implementing Classes:
AttemptRetryPolicy
,DurationRetryPolicy
public interface RetryPolicy
A strategy object to govern retry behaviours.Implementors should define their own exhaustion policy, i.e. when they will give up retrying. Implementors should track retry attempts, even if they don't leverage it when deciding exhaustion. Exampled of other uses are logging or to customize delays. Implementors should also define what kind of delay will be executed between retries.
- Since:
- 1.7
- See Also:
and its implementors for different strategies.
,Promise.retry(RetryPolicy, BiAction)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
attempts()
Attempts performed so far.Promise<Duration>
delay()
Promise that returns the waiting time before retrying.RetryPolicy
increaseAttempt()
Increase number of attempts.boolean
isExhausted()
If the caller should stop retrying.
-
-
-
Method Detail
-
isExhausted
boolean isExhausted()
If the caller should stop retrying.- Returns:
- TRUE if the caller should stop retrying
-
attempts
int attempts()
Attempts performed so far. Starts on 1, i.e. when no retry has been performed yet this returns 1.- Returns:
- attempts performed so far.
-
increaseAttempt
RetryPolicy increaseAttempt()
Increase number of attempts.- Returns:
- this policy after updating the internal state around attempts
-
delay
Promise<Duration> delay()
Promise that returns the waiting time before retrying.- Returns:
- promise that returns the waiting time before retrying
- See Also:
and its implementors for different strategies
-
-