for ( RequestHandler requestHandler : requestHandlers ) {
requestHandler.beforeRequest(request);
}
final AWSRequestMetrics metrics = executionContext.getAwsRequestMetrics();
final RequestMetricCollector mc = requestMetricCollector(request);
T t = null;
try {
t = executeHelper(request, responseHandler, errorResponseHandler, executionContext);
TimingInfo timingInfo = metrics.getTimingInfo().endTiming();
for (RequestHandler handler : requestHandlers) {
handler.afterResponse(request, t, timingInfo);
}
return t;
} catch (AmazonClientException e) {
for (RequestHandler handler : requestHandlers) {
handler.afterError(request, e);
}
throw e;
} finally {
mc.collectMetrics(request, t);
}
}