- All Implemented Interfaces:
public final class AttemptRetryPolicy extends Object implements RetryPolicyAn attempt based implementation of
This strategy will signal end of retries when the configurable max of retry attempts is surpassed, 5 by default. That number doesn't include the initial request, meaning it will give up after 6 calls, but only 5 retries.
- See Also:
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
attempts()Attempts performed so far.
delay()Promise that returns the waiting time before retrying.
increaseAttempt()Increase number of attempts.
isExhausted()If the caller should stop retrying.
of(Action<? super AttemptRetryPolicyBuilder> definition)Builds a new attempt based retry policy from the given definition.
public AttemptRetryPolicy(Delay delay, int maxAttempts)
public static AttemptRetryPolicy of(Action<? super AttemptRetryPolicyBuilder> definition) throws ExceptionBuilds a new attempt based retry policy from the given definition.
definition- the attempt based retry policy definition
- an attempt based retry policy
Exception- any thrown by building the attempt based retry policy
public boolean isExhausted()If the caller should stop retrying.
public int attempts()Attempts performed so far. Starts on 1, i.e. when no retry has been performed yet this returns 1.
delayPromise that returns the waiting time before retrying.