Example usage for com.amazonaws.services.s3.model CopyPartRequest getUploadId

List of usage examples for com.amazonaws.services.s3.model CopyPartRequest getUploadId

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model CopyPartRequest getUploadId.

Prototype

public String getUploadId() 

Source Link

Document

Returns the ID of the existing, initiated multipart upload with which this new part will be associated.

Usage

From source file:com.upplication.s3fs.AmazonS3Client.java

License:Open Source License

static CopyPartResult copyPart0(AmazonS3 client, CopyPartRequest request, S3MultipartOptions opts)
        throws IOException, InterruptedException {

    final String objectId = request.getUploadId();
    final int partNumber = request.getPartNumber();
    final long len = request.getLastByte() - request.getFirstByte();

    int attempt = 0;
    CopyPartResult result = null;//from w w  w .  jav  a 2 s.  c  om
    while (result == null) {
        attempt++;
        try {
            log.trace("Copying multipart {} with length {} attempt {} for {} ", partNumber, len, attempt,
                    objectId);
            result = client.copyPart(request);
        } catch (AmazonClientException e) {
            if (attempt >= opts.getMaxAttempts())
                throw new IOException("Failed to upload multipart data to Amazon S3", e);

            log.debug("Failed to upload part {} attempt {} for {} -- Caused by: {}", partNumber, attempt,
                    objectId, e.getMessage());
            Thread.sleep(opts.getRetrySleepWithAttempt(attempt));
        }
    }

    return result;
}