STOP, STOP_BACKOFF, ZERO_BACKOFF| Constructor and Description |
|---|
MockBackOff()
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxTries()
Returns the maximum number of tries before returning
BackOff.
|
int |
getNumberOfTries()
Returns the number of tries so far.
|
long |
nextBackOffMillis()
Gets the number of milliseconds to wait before retrying the operation or
BackOff to indicate that no retries should be made.
|
void |
reset()
Reset to initial state.
|
MockBackOff |
setBackOffMillis(long backOffMillis)
Sets the fixed back-off milliseconds (defaults to
0).
|
MockBackOff |
setMaxTries(int maxTries)
Sets the maximum number of tries before returning
BackOff (defaults to
10).
|
public void reset()
throws IOException
BackOff
reset in interface
BackOff
IOException
public long nextBackOffMillis()
throws IOException
BackOff
BackOff.STOP to indicate that no retries should be made.
Example usage:
long backOffMillis = backoff.nextBackOffMillis();
if (backOffMillis == Backoff.STOP) {
// do not retry operation
} else {
// sleep for backOffMillis milliseconds and retry operation
}
nextBackOffMillis in interface
BackOff
IOException
public MockBackOffsetBackOffMillis(long backOffMillis)
0).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public MockBackOffsetMaxTries(int maxTries)
BackOff.STOP (defaults to
10).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final int getMaxTries()
BackOff.STOP .
public final int getNumberOfTries()