HttpEntityEnclosingRequest httpEntityEnclosingRequest = (HttpEntityEnclosingRequest)method;
httpResponse.setContent(new HttpMethodReleaseInputStream(httpEntityEnclosingRequest));
}
try {
CountingInputStream countingInputStream = null;
if (System.getProperty(PROFILING_SYSTEM_PROPERTY) != null) {
countingInputStream = new CountingInputStream(httpResponse.getContent());
httpResponse.setContent(countingInputStream);
}
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
AmazonWebServiceResponse<? extends T> awsResponse;
awsRequestMetrics.startEvent(Field.ResponseProcessingTime);
try {
awsResponse = responseHandler.handle(httpResponse);
} finally {
awsRequestMetrics.endEvent(Field.ResponseProcessingTime);
}
if (countingInputStream != null) {
awsRequestMetrics.setCounter(Field.BytesProcessed, countingInputStream.getByteCount());
}
if (awsResponse == null)
throw new RuntimeException("Unable to unmarshall response metadata");