public class MockBackOff implements BackOffImplements
BackOffConstructors
MockBackOff()
public MockBackOff()Methods
getMaxTries()
public final int getMaxTries()Returns the maximum number of tries before returning #STOP.
| Returns | |
|---|---|
| Type | Description |
int |
|
getNumberOfTries()
public final int getNumberOfTries()Returns the number of tries so far.
| Returns | |
|---|---|
| Type | Description |
int |
|
nextBackOffMillis()
public long nextBackOffMillis()Gets the number of milliseconds to wait before retrying the operation or #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 }
| Returns | |
|---|---|
| Type | Description |
long |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
reset()
public void reset()Reset to initial state.
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
setBackOffMillis(long backOffMillis)
public MockBackOff setBackOffMillis(long backOffMillis)Sets the fixed back-off milliseconds (defaults to 0).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
| Parameter | |
|---|---|
| Name | Description |
backOffMillis |
long |
| Returns | |
|---|---|
| Type | Description |
MockBackOff |
|
setMaxTries(int maxTries)
public MockBackOff setMaxTries(int maxTries)Sets the maximum number of tries before returning #STOP (defaults to 10).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
| Parameter | |
|---|---|
| Name | Description |
maxTries |
int |
| Returns | |
|---|---|
| Type | Description |
MockBackOff |
|