public interface RetryPolicy
A retry policy can control two parameters:
retry(VolleyError)
, although getCurrentRetryCount()
should always return the current retry count for logging purposes.
getCurrentTimeout()
. In the common case that
a request times out before the response has been received from the server, retrying again
with a longer timeout can increase the likelihood of success (at the expense of causing the
user to wait longer, especially if the request still fails).
Note that currently, retries triggered by a retry policy are attempted immediately in sequence
with no delay between them (although the time between tries may increase if the requests are
timing out and getCurrentTimeout()
is returning increasing values).
By default, Volley uses DefaultRetryPolicy
.
Modifier and Type | Method and Description |
---|---|
int |
getCurrentRetryCount()
Returns the current retry count (used for logging).
|
int |
getCurrentTimeout()
Returns the current timeout (used for logging).
|
void |
retry(VolleyError error)
Prepares for the next retry by applying a backoff to the timeout.
|
int getCurrentTimeout()
int getCurrentRetryCount()
void retry(VolleyError error) throws VolleyError
error
- The error code of the last attempt.VolleyError
- In the event that the retry could not be performed (for example if we ran
out of attempts), the passed in error is thrown.