throw new ResponseException((ResponseException) exception);
@Override public void completed(HttpResponse httpResponse) { try { RequestLogger.logResponse(logger, request, host, httpResponse); int statusCode = httpResponse.getStatusLine().getStatusCode(); Response response = new Response(request.getRequestLine(), host, httpResponse); if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) { onResponse(host); listener.onSuccess(response); } else { ResponseException responseException = new ResponseException(response); if (isRetryStatus(statusCode)) { //mark host dead and retry against next one onFailure(host); retryIfPossible(responseException); } else { //mark host alive and don't retry, as the error should be a request problem onResponse(host); listener.onDefinitiveFailure(responseException); } } } catch(Exception e) { listener.onDefinitiveFailure(e); } }
@Override public void completed(HttpResponse httpResponse) { try { RequestLogger.logResponse(logger, request, host, httpResponse); int statusCode = httpResponse.getStatusLine().getStatusCode(); Response response = new Response(request.getRequestLine(), host, httpResponse); if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) { onResponse(host); listener.onSuccess(response); } else { ResponseException responseException = new ResponseException(response); if (isRetryStatus(statusCode)) { //mark host dead and retry against next one onFailure(host); retryIfPossible(responseException); } else { //mark host alive and don't retry, as the error should be a request problem onResponse(host); listener.onDefinitiveFailure(responseException); } } } catch(Exception e) { listener.onDefinitiveFailure(e); } }
@Override public void completed(HttpResponse httpResponse) { try { RequestLogger.logResponse(logger, request, node.getHost(), httpResponse); int statusCode = httpResponse.getStatusLine().getStatusCode(); Response response = new Response(request.getRequestLine(), node.getHost(), httpResponse); if (isSuccessfulResponse(statusCode) || ignoreErrorCodes.contains(response.getStatusLine().getStatusCode())) { onResponse(node); if (strictDeprecationMode && response.hasWarnings()) { listener.onDefinitiveFailure(new ResponseException(response)); } else { listener.onSuccess(response); } } else { ResponseException responseException = new ResponseException(response); if (isRetryStatus(statusCode)) { //mark host dead and retry against next one onFailure(node); retryIfPossible(responseException); } else { //mark host alive and don't retry, as the error should be a request problem onResponse(node); listener.onDefinitiveFailure(responseException); } } } catch(Exception e) { listener.onDefinitiveFailure(e); } }