I use the Apache HTTP community DefaultHttpClientand, after building, I install its retry handler:
httpClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler() {
@Override
public boolean retryRequest(final IOException ioe,
final int numRetry, final HttpContext context)
{
Log.d(TAG, "retry handler received exception of type: " + ioe.getClass().getName() + ", num retries: " + numRetry);
if (numRetry > 4) {
return false;
}
if (ioe instanceof NoHttpResponseException
|| ioe instanceof UnknownHostException
|| ioe instanceof SocketException) {
}
return false;
}
});
The server to which I send my requests for a frequent timeout, and in catchmy call to execute (), I get an I / O error "Operation timeout", however I never see the "retry handler" received exception like "log expression in my console release.All my requests are POST requests, but they are idempotent - they are safe to call several times without adverse side effects.
Am I setting the retry handler incorrectly? Is the retry handler only called in certain scenarios?