public class MaxAttemptRetryPolicy extends AbstractRetryPolicy
Constructor and Description |
---|
MaxAttemptRetryPolicy(int maxAttempts,
DelayPolicy delayPolicy)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isRetriable(int numAttempts,
long firstAttemptTimestamp)
Determines whether a retry should be attempted.
|
java.lang.String |
toString()
Returns a string of the form: "Up to 3 attempts, 10 seconds between each attempt."
|
getDelay
public MaxAttemptRetryPolicy(int maxAttempts, DelayPolicy delayPolicy)
maxAttempts
- -
the maximum number of attempts (first attempt and retries)
that will be allowed; must be >= 1delayPolicy
- -
the policy for computing delays between attempts; must be
non-nullpublic boolean isRetriable(int numAttempts, long firstAttemptTimestamp)
numAttempts
- -
the number of previous attempts (including first attempt and
previous retries); assumed to be equal or more than 1firstAttemptTimestamp
- -
the timestamp (milliseconds since epoch) of the first attempt
to process the message; may be less than 0 if information not
availabletrue
if a retry should be attempted; otherwise,
false
public java.lang.String toString()
toString
in interface DelayPolicy
toString
in class AbstractRetryPolicy