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.STOP . |
int |
getNumberOfTries()
Returns the number of tries so far.
|
long |
nextBackOffMillis()
Gets the number of milliseconds to wait before retrying the operation or
BackOff.STOP 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.STOP (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 MockBackOff setBackOffMillis(long backOffMillis)
0
).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public MockBackOff setMaxTries(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()
Copyright © 2011–2021 Google. All rights reserved.