Source:
<code>private void discardRequestsResponses() { logger.trace("Discarding requests/responses on account of shutdown"); RestServiceException e = new RestServiceException("Service shutdown", RestServiceErrorCode.ServiceUnavailable); if (requests.size() > 0) { logger.info("There were requests in flight during shutdown", requests.size()); restServerMetrics.residualRequestQueueSize.inc(requests.size()); AsyncRequestInfo residualRequestInfo = requests.poll(); while (residualRequestInfo != null) { <START> onRequestDequeue(residualRequestInfo); <END> onResponseComplete(residualRequestInfo.getRestRequest(), residualRequestInfo.getRestResponseChannel(), e, true); releaseResources(residualRequestInfo.getRestRequest(), null); residualRequestInfo = requests.poll(); } } if (responses.size() > 0) { logger.info("There were responses in flight during was shut down", responses.size()); restServerMetrics.residualResponseSetSize.inc(responses.size()); Iterator<Map.Entry<RestRequest, AsyncResponseInfo>> responseIterator = responses.entrySet().iterator(); while (responseIterator.hasNext()) { Map.Entry<RestRequest, AsyncResponseInfo> responseInfo = responseIterator.next(); RestRequest restRequest = responseInfo.getKey(); AsyncResponseInfo asyncResponseInfo = responseInfo.getValue(); onResponseDequeue(restRequest, asyncResponseInfo); ReadableStreamChannel response = asyncResponseInfo.getResponse(); RestResponseChannel restResponseChannel = asyncResponseInfo.getRestResponseChannel(); onResponseComplete(restRequest, restResponseChannel, e, true); releaseResources(restRequest, response); responseIterator.remove(); } } }</code><technical_language>this done previously</technical_language>

Target:
private void discardRequestsResponses() { logger.trace("Discarding requests/responses on account of shutdown"); RestServiceException e = new RestServiceException("Service shutdown", RestServiceErrorCode.ServiceUnavailable); if (requests.size() > 0) { logger.info("There were requests in flight during shutdown", requests.size()); restServerMetrics.residualRequestQueueSize.inc(requests.size()); AsyncRequestInfo residualRequestInfo = requests.poll(); while (residualRequestInfo != null) { onRequestDequeue(residualRequestInfo); onResponseComplete(residualRequestInfo.getRestRequest(), residualRequestInfo.getRestResponseChannel(), e, true); residualRequestInfo = requests.poll(); } } if (responses.size() > 0) { logger.info("There were responses in flight during was shut down", responses.size()); restServerMetrics.residualResponseSetSize.inc(responses.size()); Iterator<Map.Entry<RestRequest, AsyncResponseInfo>> responseIterator = responses.entrySet().iterator(); while (responseIterator.hasNext()) { Map.Entry<RestRequest, AsyncResponseInfo> responseInfo = responseIterator.next(); RestRequest restRequest = responseInfo.getKey(); AsyncResponseInfo asyncResponseInfo = responseInfo.getValue(); long processingDelay = asyncResponseInfo.getProcessingDelay(); restRequest.getMetricsTracker().scalingMetricsTracker.addToResponseProcessingWaitTime(processingDelay); ReadableStreamChannel response = asyncResponseInfo.getResponse(); RestResponseChannel restResponseChannel = asyncResponseInfo.getRestResponseChannel(); onResponseComplete(restRequest, restResponseChannel, e, true); queuedResponseCount.decrementAndGet(); restServerMetrics.responseCompletionRate.mark(); releaseResources(response); responseIterator.remove(); } } }