public class MaxTimeRetryPolicy extends AbstractRetryPolicy
Constructor and Description |
---|
MaxTimeRetryPolicy(long maxElapsedMillis,
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 60 seconds, 10 seconds between each attempt."
|
getDelay
public MaxTimeRetryPolicy(long maxElapsedMillis, DelayPolicy delayPolicy)
maxElapsedMillis
- -
the maximum time (in milliseconds) that can elapse between the
first attempt and subsequent retries; must be > 0delayPolicy
- -
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