public class CopyCallable extends java.lang.Object implements java.util.concurrent.Callable<CopyResult>
TransferManager
in carrying out the copy requests. The call
method checks if multi-part copy request can be carried out on the Amazon S3
object. This is done by checking the size of the Amazon S3 object being
copied.
If the size of the object is greater than the preferred size limit, then copy operation is carried out as multi part copy requests to the server.
If the size of the object is less than the preferred size limit, the copy operation is carried out in a single request where the Amazon S3 object is transferred as one chunk from the source bucket to the destination bucket.
Modifier and Type | Field and Description |
---|---|
private TransferManagerConfiguration |
configuration
TransferManager configuration that provides details on when
to use multi-part copy, part size etc., |
private CopyImpl |
copy |
private CopyObjectRequest |
copyObjectRequest
A reference to the original copy request received.
|
private java.util.List<java.util.concurrent.Future<PartETag>> |
futures
A list of future objects to be returned when multi-part copy is
initiated.
|
private ProgressListenerChain |
listenerChain |
private static org.apache.commons.logging.Log |
log |
private ObjectMetadata |
metadata
Metadata of the object in the source bucket to be copied.
|
private java.lang.String |
multipartUploadId
Upload id to be used when sending copy part requests.
|
private AmazonS3 |
s3
A reference to the Amazon S3 client using which copy or copy part
requests are initiated.
|
private java.util.concurrent.ExecutorService |
threadPool
Thread pool used during multi-part copy is performed.
|
Constructor and Description |
---|
CopyCallable(TransferManager transferManager,
java.util.concurrent.ExecutorService threadPool,
CopyImpl copy,
CopyObjectRequest copyObjectRequest,
ObjectMetadata metadata,
ProgressListenerChain progressListenerChain) |
Modifier and Type | Method and Description |
---|---|
CopyResult |
call() |
private CopyResult |
copyInOneChunk()
Performs the copy of the Amazon S3 object from source bucket to
destination bucket.
|
private void |
copyInParts()
Performs the copy of an Amazon S3 object from source bucket to
destination bucket as multiple copy part requests.
|
private void |
copyPartsInParallel(CopyPartRequestFactory requestFactory)
Submits a callable for each part to be copied to our thread pool and
records its corresponding Future.
|
(package private) java.util.List<java.util.concurrent.Future<PartETag>> |
getFutures() |
(package private) java.lang.String |
getMultipartUploadId() |
private long |
getOptimalPartSize(long contentLengthOfSource)
Computes and returns the optimal part size for the copy operation.
|
private java.lang.String |
initiateMultipartUpload(CopyObjectRequest origReq)
Initiates a multipart upload and returns the upload id
|
boolean |
isMultipartCopy()
Returns true if this CopyCallable is processing a multi-part copy.
|
private void |
populateMetadataWithEncryptionParams(ObjectMetadata source,
ObjectMetadata destination) |
private final AmazonS3 s3
private final java.util.concurrent.ExecutorService threadPool
private final CopyObjectRequest copyObjectRequest
private java.lang.String multipartUploadId
private final ObjectMetadata metadata
private final CopyImpl copy
private static final org.apache.commons.logging.Log log
private final TransferManagerConfiguration configuration
TransferManager
configuration that provides details on when
to use multi-part copy, part size etc.,private final java.util.List<java.util.concurrent.Future<PartETag>> futures
private final ProgressListenerChain listenerChain
public CopyCallable(TransferManager transferManager, java.util.concurrent.ExecutorService threadPool, CopyImpl copy, CopyObjectRequest copyObjectRequest, ObjectMetadata metadata, ProgressListenerChain progressListenerChain)
java.util.List<java.util.concurrent.Future<PartETag>> getFutures()
java.lang.String getMultipartUploadId()
public boolean isMultipartCopy()
public CopyResult call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<CopyResult>
java.lang.Exception
private CopyResult copyInOneChunk()
private void copyInParts() throws java.lang.Exception
java.lang.Exception
- Any Exception that occurs while carrying out the request.private long getOptimalPartSize(long contentLengthOfSource)
private void copyPartsInParallel(CopyPartRequestFactory requestFactory)
private java.lang.String initiateMultipartUpload(CopyObjectRequest origReq)
private void populateMetadataWithEncryptionParams(ObjectMetadata source, ObjectMetadata destination)