我使用了Apache HTTP公共DefaultHttpClient
和施工後,我設置了重傳處理器:Apache的HttpClient的HttpRequestRetryHandler從未引用
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) { // 3 retries
return false;
}
// Some exceptions we can retry without knowledge of which methods are being invoked
if (ioe instanceof NoHttpResponseException
|| ioe instanceof UnknownHostException
|| ioe instanceof SocketException) {
}
return false;
}
});
,我送我的請求,經常超時的服務器,在我的execute()調用的catch
中,我收到一個IO錯誤,「操作超時」,但是我從來沒有在控制檯輸出中看到任何「重試處理程序接收到類型」log語句的異常。我的所有請求都是POST請求,但它們是冪等的 - 它們可以安全地多次調用而沒有不良的副作用。
我是否設置了錯誤的重試處理程序?是否僅在某些情況下調用重試處理程序?
不幸的是我不再有權限訪問項目源代碼,所以我不能試用這個。 – skyler 2013-07-09 15:03:24