Source:
private void processResponses() { Iterator<Map.Entry<RestRequest, AsyncResponseInfo>> responseIterator = responses.entrySet().iterator(); while (responseIterator.hasNext()) { Map.Entry<RestRequest, AsyncResponseInfo> responseInfo = responseIterator.next(); long processingStartTime = System.currentTimeMillis(); long responseProcessingTime = 0; RestRequest restRequest = responseInfo.getKey(); try { AsyncResponseInfo asyncResponseInfo = responseInfo.getValue(); ReadableStreamChannel response = asyncResponseInfo.getResponse(); RestResponseChannel restResponseChannel = asyncResponseInfo.getRestResponseChannel(); int bytesWritten = 0; Exception exception = null; try { long processingDelay = asyncResponseInfo.getProcessingDelay(); restRequest.getMetricsTracker().scalingMetricsTracker.addToResponseProcessingDelay(processingDelay); long responseWriteStartTime = System.currentTimeMillis(); bytesWritten = response.read(restResponseChannel); responseProcessingTime = System.currentTimeMillis() - responseWriteStartTime; logger.trace("{} response bytes were written for request {}", bytesWritten, restRequest.getUri()); } catch (Exception e) { restServerMetrics.responseProcessingError.inc(); exception = e; } if (bytesWritten == -1 || exception != null) { long responseCompleteStartTime = System.currentTimeMillis(); onResponseComplete(restRequest, restResponseChannel, exception, false); responseProcessingTime += (System.currentTimeMillis() - responseCompleteStartTime); releaseResources(response); responseIterator.remove(); queuedResponseCount.decrementAndGet(); restServerMetrics.responseCompletionRate.mark(); logger.trace("Response complete for request {}", restRequest.getUri()); } else { asyncResponseInfo.recordProcessingEndTime(); } } finally { restRequest.getMetricsTracker().scalingMetricsTracker .addToResponseProcessingTime(System.currentTimeMillis() - processingStartTime - responseProcessingTime); } } }

Target:
private void processResponses() { Iterator<Map.Entry<RestRequest, AsyncResponseInfo>> responseIterator = responses.entrySet().iterator(); while (responseIterator.hasNext()) { Map.Entry<RestRequest, AsyncResponseInfo> responseInfo = responseIterator.next(); long processingStartTime = System.currentTimeMillis(); long responseProcessingTime = 0; RestRequest restRequest = responseInfo.getKey(); try { AsyncResponseInfo asyncResponseInfo = responseInfo.getValue(); ReadableStreamChannel response = asyncResponseInfo.getResponse(); RestResponseChannel restResponseChannel = asyncResponseInfo.getRestResponseChannel(); int bytesWritten = 0; Exception exception = null; try { long processingDelay = asyncResponseInfo.getProcessingDelay(); restRequest.getMetricsTracker().scalingMetricsTracker.addToResponseProcessingWaitTime(processingDelay); long responseWriteStartTime = System.currentTimeMillis(); bytesWritten = response.read(restResponseChannel); responseProcessingTime = System.currentTimeMillis() - responseWriteStartTime; logger.trace("{} response bytes were written for request {}", bytesWritten, restRequest.getUri()); } catch (Exception e) { restServerMetrics.responseProcessingError.inc(); exception = e; } if (bytesWritten == -1 || exception != null) { long responseCompleteStartTime = System.currentTimeMillis(); onResponseComplete(restRequest, restResponseChannel, exception, false); responseProcessingTime += (System.currentTimeMillis() - responseCompleteStartTime); releaseResources(response); responseIterator.remove(); queuedResponseCount.decrementAndGet(); restServerMetrics.responseCompletionRate.mark(); logger.trace("Response complete for request {}", restRequest.getUri()); } else { asyncResponseInfo.recordProcessingEndTime(); } } finally { restRequest.getMetricsTracker().scalingMetricsTracker .addToResponseProcessingTime(System.currentTimeMillis() - processingStartTime - responseProcessingTime); } } }