Example usage for com.amazonaws.services.s3.transfer Upload abort

List of usage examples for com.amazonaws.services.s3.transfer Upload abort

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.transfer Upload abort.

Prototype

public void abort();

Source Link

Document

Abort the current upload operation.

Usage

From source file:com.liferay.portal.store.s3.S3Store.java

License:Open Source License

protected void putObject(long companyId, long repositoryId, String fileName, String versionLabel, File file)
        throws PortalException {

    Upload upload = null;

    try {//from   w ww.  j a v a 2s . c om
        String key = _s3KeyTransformer.getFileVersionKey(companyId, repositoryId, fileName, versionLabel);

        PutObjectRequest putObjectRequest = new PutObjectRequest(_bucketName, key, file);

        putObjectRequest.withStorageClass(_storageClass);

        upload = _transferManager.upload(putObjectRequest);

        upload.waitForCompletion();
    } catch (AmazonClientException ace) {
        throw transform(ace);
    } catch (InterruptedException ie) {
        upload.abort();

        Thread thread = Thread.currentThread();

        thread.interrupt();
    }
}