public class FixedDelayPolicy extends java.lang.Object implements DelayPolicy
Constructor and Description |
---|
FixedDelayPolicy(long delayMillis)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
getDelay(int numAttempts,
long lastDelay)
Gets the minimum amount of time that must elapse before the next retry
attempt.
|
java.lang.String |
toString()
Returns a string of the form "10 seconds between attempts".
|
public FixedDelayPolicy(long delayMillis)
delayMillis
- -
the miminum delay (in milliseconds) between each retry
attempt; must be >= 0 with 0 indicating no delaypublic long getDelay(int numAttempts, long lastDelay)
getDelay
in interface DelayPolicy
numAttempts
- -
the number of previous attempts (including first attempt and
retries); assumed to be >= 1lastDelay
- -
the delay (in milliseconds) returned by the previous call to
this method (i.e., with numAttempts-1
); -1 if
not previously code (i.e., when numAttempts==0
public java.lang.String toString()
toString
in interface DelayPolicy
toString
in class java.lang.Object