Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2010-2015, Inc. or its affiliates. All Rights Reserved.
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
  * or in the "license" file accompanying this file. This file is distributed
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
 import java.util.List;
Initiates a complete multi-part upload request for a TransferManager multi-part parallel upload.
 public class CompleteMultipartUpload implements Callable<UploadResult> {

The upload id associated with the multi-part upload.
     private final String uploadId;

The reference to underlying Amazon S3 client to be used for initiating requests to Amazon S3.
     private final AmazonS3 s3;

The reference to the request initiated by the user.
     private final PutObjectRequest origReq;

The futures of threads that upload individual parts.
     private final List<Future<PartETag>> futures;

The eTags of the parts that had been successfully uploaded before resuming a paused upload.
     private final List<PartETageTagsBeforeResume;

The monitor to which the upload progress has to be communicated.
     private final UploadMonitor monitor;
     public CompleteMultipartUpload(String uploadIdAmazonS3 s3,
             PutObjectRequest putObjectRequestList<Future<PartETag>> futures,
             List<PartETageTagsBeforeResumeUploadMonitor monitor) {
         this. = uploadId;
         this. = s3;
         this. = putObjectRequest;
         this. = futures;
         this. = eTagsBeforeResume;
         this. = monitor;
     public UploadResult call() throws Exception {
                 .getBucketName(), .getKey(), ,
         UploadResult uploadResult = new UploadResult();
         return uploadResult;

Collects the Part ETags for initiating the complete multi-part upload request. This is blocking as it waits until all the upload part threads complete.
     private List<PartETagcollectPartETags() {
         final List<PartETagpartETags = new ArrayList<PartETag>();
        for (Future<PartETagfuture : ) {
            try {
            } catch (Exception e) {
                throw new AmazonClientException(
                        "Unable to complete multi-part upload. Individual part upload failed : "
                                + e.getCause().getMessage(), e.getCause());
        return partETags;
New to GrepCode? Check out our FAQ X