@Override public void invoke(int statusCode, String reasonPhrase, String responseBody) { if (failed.compareAndSet(false, true)) { nextError.invoke(statusCode, reasonPhrase, responseBody); } } };
/** * Stop the request timer, start the response timer, and then invoke the error callback code. * * @param statusCode Http status code of the error response * @param reasonPhrase The reason for the error. Often the status code description. * @param responseBody The body of the error response */ default void dispatch(int statusCode, String reasonPhrase, String responseBody) { RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER); RequestLog.startTiming(RESPONSE_WORKFLOW_TIMER); invoke(statusCode, reasonPhrase, responseBody); } }
@Override public void invoke(int statusCode, String reason, String responseBody) { if (RequestLog.isRunning(REQUEST_WORKFLOW_TIMER)) { RequestLog.stopTiming(REQUEST_WORKFLOW_TIMER); } next.getErrorCallback(druidQuery).invoke(statusCode, reason, responseBody); } };
/** * Count and log error, then send error response. * * @param status The response status * @param response The druid response * @param druidQueryId The Druid query ID * @param error callback for handling http errors. */ private void markError(Status status, Response response, String druidQueryId, HttpErrorCallback error) { getHttpErrorMeter().mark(); LOG.debug( "druid {} error: {} {} {} and druid query id: {}", getServiceConfig().getNameAndUrl(), status.getStatusCode(), status.getReasonPhrase(), response.getResponseBody(), druidQueryId ); error.invoke( status.getStatusCode(), status.getReasonPhrase(), response.getResponseBody() ); } }
success.invoke(mapper.readTree(jsonResponse.call())); } else { error.invoke(statusCode, reasonPhrase, jsonResponse.call());
success.invoke(mapper.readTree(jsonResponse.call())); } else { error.invoke(statusCode, reasonPhrase, jsonResponse.call());
success.invoke(mapper.readTree(jsonResponse.call())); } else { error.invoke(statusCode, reasonPhrase, jsonResponse.call());
success.invoke(mapper.readTree(jsonResponse.call())); } else { error.invoke(statusCode, reasonPhrase, jsonResponse.call());