@Override
    public T handle(HttpResponse response) throws Exception {
        final AmazonWebServiceResponse<T> awsResponse = delegate.handle(response);

        if (awsResponse == null) {
            throw new RuntimeException("Unable to unmarshall response metadata. Response Code: "
                                       + response.getStatusCode() + ", Response Text: " +
                                       response.getStatusText());
        }

        AmazonWebServiceRequest userRequest = request.getOriginalRequest();
        if (userRequest.getCloneRoot() != null) {
            userRequest = userRequest.getCloneRoot();
        }
        responseMetadataCache.add(userRequest, awsResponse.getResponseMetadata());
        final String awsRequestId = awsResponse.getRequestId();

        if (requestLog.isDebugEnabled()) {
            requestLog
                    .debug("Received successful response: " + response.getStatusCode() +
                           ", AWS Request ID: " + awsRequestId);
        }

        if (!logHeaderRequestId(response)) {
            // Logs the AWS request ID extracted from the payload if
            // it is not available from the response header.
            logResponseRequestId(awsRequestId);
        }

        logExtendedRequestId(response);

        awsRequestMetrics.addProperty(AWSRequestMetrics.Field.AWSRequestID, awsRequestId);
        return fillInResponseMetadata(awsResponse, response);
    }
@param delegate          Response handler to delegate to and unwrap
@param request           Marshalled request
@param awsRequestMetrics Request metrics
aws-java-sdk-core/src/main/java/com/amazonaws/http/response/AwsResponseHandlerAdapter.java