Source:
void handleResponse(ResponseInfo responseInfo) { DeleteRequest deleteRequest = (DeleteRequest) responseInfo.getRequest(); DeleteRequestInfo deleteRequestInfo = deleteRequestInfos.remove(deleteRequest.getCorrelationId()); if (deleteRequestInfo == null) { return; } ReplicaId replica = deleteRequestInfo.replica; RouterErrorCode routerErrorCode; long requestLatencyMs = time.milliseconds() - deleteRequestInfo.getStartTimeMs(); NonBlockingRouterMetrics.NodeLevelMetrics dataNodeBasedMetrics = routerMetrics.getDataNodeBasedMetrics(deleteRequestInfo.replica.getDataNodeId()); routerMetrics.routerRequestLatencyMs.update(requestLatencyMs); dataNodeBasedMetrics.putRequestLatencyMs.update(requestLatencyMs); if (responseInfo.getError() != null) { responseHandler.onRequestResponseException(replica, new IOException(("NetworkClient error."))); routerErrorCode = RouterErrorCode.OperationTimedOut; updateOperationState(replica, routerErrorCode); } else { try { DeleteResponse deleteResponse = DeleteResponse.readFrom(new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse()))); if (deleteResponse.getCorrelationId() != deleteRequest.getCorrelationId()) { logger.error("The correlation id in the DeleteResponse " + deleteResponse.getCorrelationId() + " is not the same as the correlation id in the associated DeleteRequest: " + deleteRequest .getCorrelationId()); routerMetrics.unknownReplicaResponseError.inc(); setOperationException( new RouterException("Received wrong response that is not for the corresponding request.", RouterErrorCode.UnexpectedInternalError)); routerErrorCode = RouterErrorCode.UnexpectedInternalError; updateOperationState(replica, routerErrorCode); } else { responseHandler.onRequestResponseError(replica, deleteResponse.getError()); routerErrorCode = processServerError(replica, deleteResponse.getError()); } } catch (IOException e) { logger.error("Unable to recover a deleteResponse from received stream."); routerErrorCode = RouterErrorCode.UnexpectedInternalError; updateOperationState(replica, routerErrorCode); } } checkAndMaybeComplete(); if (routerErrorCode != null) { dataNodeBasedMetrics.deleteRequestErrorCount.inc(); } }

Target:
void handleResponse(ResponseInfo responseInfo) { DeleteRequest deleteRequest = (DeleteRequest) responseInfo.getRequest(); DeleteRequestInfo deleteRequestInfo = deleteRequestInfos.remove(deleteRequest.getCorrelationId()); if (deleteRequestInfo == null) { return; } ReplicaId replica = deleteRequestInfo.replica; RouterErrorCode routerErrorCode; long requestLatencyMs = time.milliseconds() - deleteRequestInfo.startTimeMs; NonBlockingRouterMetrics.NodeLevelMetrics dataNodeBasedMetrics = routerMetrics.getDataNodeBasedMetrics(replica.getDataNodeId()); routerMetrics.routerRequestLatencyMs.update(requestLatencyMs); dataNodeBasedMetrics.deleteRequestLatencyMs.update(requestLatencyMs); if (responseInfo.getError() != null) { responseHandler.onRequestResponseException(replica, new IOException(("NetworkClient error."))); routerErrorCode = RouterErrorCode.OperationTimedOut; updateOperationState(replica, routerErrorCode); } else { try { DeleteResponse deleteResponse = DeleteResponse.readFrom(new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse()))); if (deleteResponse.getCorrelationId() != deleteRequest.getCorrelationId()) { logger.error("The correlation id in the DeleteResponse " + deleteResponse.getCorrelationId() + " is not the same as the correlation id in the associated DeleteRequest: " + deleteRequest .getCorrelationId()); routerMetrics.unknownReplicaResponseError.inc(); setOperationException( new RouterException("Received wrong response that is not for the corresponding request.", RouterErrorCode.UnexpectedInternalError)); routerErrorCode = RouterErrorCode.UnexpectedInternalError; updateOperationState(replica, routerErrorCode); } else { responseHandler.onRequestResponseError(replica, deleteResponse.getError()); routerErrorCode = processServerError(replica, deleteResponse.getError()); } } catch (IOException e) { logger.error("Unable to recover a deleteResponse from received stream."); routerErrorCode = RouterErrorCode.UnexpectedInternalError; updateOperationState(replica, routerErrorCode); } } checkAndMaybeComplete(); if (routerErrorCode != null) { dataNodeBasedMetrics.deleteRequestErrorCount.inc(); } }