com.neomades.content.retry.RetryPolicy |
![]() |
Retry policy for a request.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract int |
getCurrentRetryCount()
Returns the current retry count (this getter is used for logging).
| ||||||||||
abstract int |
getCurrentTimeout()
Returns the current timeout (this getter is used for logging).
| ||||||||||
abstract void |
retry(ContentError error)
Prepares for the next retry by applying a backoff to the timeout.
|
Returns the current retry count (this getter is used for logging).
This getter is used by ContentManager
to print out to the console
(for logging), after how many retry count the query is retrying.
This value should be used and updated by RetryPolicy
implementation.
Returns the current timeout (this getter is used for logging).
This getter is used by ContentManager
to print out to the console
(for logging), after which timeout the query is retrying.
This value should be used and updated by RetryPolicy
implementation.
Prepares for the next retry by applying a backoff to the timeout.
If the retry() method never throws an exception, then it will retry forever. Be sure reusing the current time out and the retry count to stop retrying by throwing an exception.
public void retry(ContentError error) throws Exception { if (error.isNoConnectionError()) { // deals with no connection error // <some part of code> // stop retry throw error.getException(); } else { // let the retry policy continue to the next retry step } }
error | The error code of the last attempt. |
---|
ContentException | In the event that the retry could not be performed (for example if we ran out of attempts), the passed in error is thrown. The query will not retry in this case. |
---|