@NotThreadSafe public final class TransferManagerBuilder extends Object
TransferManager
. Use of the builder is preferred over constructors in
the TransferManager class.
Note that if no AmazonS3
is provided via withS3Client(AmazonS3)
} or setS3Client(AmazonS3)
a default client will be created using DefaultAwsRegionProviderChain
and DefaultAWSCredentialsProviderChain
.Modifier and Type | Method and Description |
---|---|
TransferManager |
build()
Construct a TransferManager with the default ExecutorService.
|
static TransferManager |
defaultTransferManager() |
TransferManagerBuilder |
disableParallelDownloads()
Disables parallel downloads, see
setDisableParallelDownloads(Boolean) |
boolean |
getAlwaysCalculateMultipartMd5()
Returns true if Transfer Manager should calculate MD5 for multipart uploads.
|
ExecutorFactory |
getExecutorFactory() |
Long |
getMinimumUploadPartSize() |
Long |
getMultipartCopyPartSize() |
Long |
getMultipartCopyThreshold() |
Long |
getMultipartUploadThreshold() |
AmazonS3 |
getS3Client() |
Boolean |
isDisableParallelDownloads()
Returns if the parallel downloads are disabled or not.
|
Boolean |
isShutDownThreadPools() |
void |
setAlwaysCalculateMultipartMd5(boolean alwaysCalculateMultipartMd5)
Set to true if Transfer Manager should calculate MD5 for multipart uploads.
|
void |
setDisableParallelDownloads(Boolean disableParallelDownloads)
Sets the option to disable parallel downloads.
|
void |
setExecutorFactory(ExecutorFactory executorFactory)
Sets a new
ExecutorFactory for the builder. |
void |
setMinimumUploadPartSize(Long minimumUploadPartSize)
Sets the minimum part size for upload parts.
|
void |
setMultipartCopyPartSize(Long multipartCopyPartSize)
Sets the minimum size in bytes of each part when a multi-part copy operation is carried out.
|
void |
setMultipartCopyThreshold(Long multipartCopyThreshold)
Sets the size threshold, in bytes, for when to use multi-part copy.
|
void |
setMultipartUploadThreshold(Long multipartUploadThreshold)
Sets the size threshold, in bytes, for when to use multipart uploads.
|
void |
setS3Client(AmazonS3 s3Client)
Sets the low level client used to make the service calls to Amazon S3.
|
void |
setShutDownThreadPools(Boolean shutDownThreadPools)
By default, when the transfer manager is shut down, the underlying
ExecutorService is
also shut down. |
static TransferManagerBuilder |
standard() |
TransferManagerBuilder |
withAlwaysCalculateMultipartMd5(boolean alwaysCalculateMultipartMd5)
Set to true if Transfer Manager should calculate MD5 for multipart uploads.
|
TransferManagerBuilder |
withDisableParallelDownloads(Boolean disableParallelDownloads)
Sets the option to disable parallel downloads.
|
TransferManagerBuilder |
withExecutorFactory(ExecutorFactory executorFactory)
Sets a new
ExecutorFactory for the builder. |
TransferManagerBuilder |
withMinimumUploadPartSize(Long minimumUploadPartSize)
Sets the minimum part size for upload parts.
|
TransferManagerBuilder |
withMultipartCopyPartSize(Long multipartCopyPartSize)
Sets the minimum size in bytes of each part when a multi-part copy operation is carried out.
|
TransferManagerBuilder |
withMultipartCopyThreshold(Long multipartCopyThreshold)
Sets the size threshold, in bytes, for when to use multi-part copy.
|
TransferManagerBuilder |
withMultipartUploadThreshold(Long multipartUploadThreshold)
Sets the size threshold, in bytes, for when to use multipart uploads.
|
TransferManagerBuilder |
withS3Client(AmazonS3 s3Client)
Sets the low level client used to make the service calls to Amazon S3.
|
TransferManagerBuilder |
withShutDownThreadPools(Boolean shutDownThreadPools)
By default, when the transfer manager is shut down, the underlying
ExecutorService is
also shut down. |
public static TransferManagerBuilder standard()
public static TransferManager defaultTransferManager()
AmazonS3ClientBuilder
to create a default AmazonS3
client implementation.public final AmazonS3 getS3Client()
public final void setS3Client(AmazonS3 s3Client)
DefaultAwsRegionProviderChain
and DefaultAWSCredentialsProviderChain
.s3Client
- Client implementation to usepublic final TransferManagerBuilder withS3Client(AmazonS3 s3Client)
DefaultAwsRegionProviderChain
and DefaultAWSCredentialsProviderChain
.s3Client
- Client implementation to usepublic final ExecutorFactory getExecutorFactory()
ExecutorFactory
currently configured in the builder.public final void setExecutorFactory(ExecutorFactory executorFactory)
ExecutorFactory
for the builder. The factory is invoked for each transfer
manager created through the builder.executorFactory
- New executor factory to use.public final TransferManagerBuilder withExecutorFactory(ExecutorFactory executorFactory)
ExecutorFactory
for the builder. The factory is invoked for each transfer
manager created through the builder.executorFactory
- New executor factory to use.public final Boolean isShutDownThreadPools()
public final void setShutDownThreadPools(Boolean shutDownThreadPools)
ExecutorService
is
also shut down. For cases where the same thread pool is reused across different workloads you
can set this option to false to disable that behavior.shutDownThreadPools
- True to shut down thread pools on transfer manager shutdown, false
otherwise.public final TransferManagerBuilder withShutDownThreadPools(Boolean shutDownThreadPools)
ExecutorService
is
also shut down. For cases where the same thread pool is reused across different workloads you
can set this option to false to disable that behavior.shutDownThreadPools
- True to shut down thread pools on transfer manager shutdown, false
otherwise.public final Long getMinimumUploadPartSize()
public final void setMinimumUploadPartSize(Long minimumUploadPartSize)
minimumUploadPartSize
- New minimum threshold for upload part sizepublic final TransferManagerBuilder withMinimumUploadPartSize(Long minimumUploadPartSize)
minimumUploadPartSize
- New minimum threshold for upload part sizepublic final Long getMultipartUploadThreshold()
public final void setMultipartUploadThreshold(Long multipartUploadThreshold)
Multipart uploads are easier to recover from and also potentially faster than single part uploads, especially when the upload parts can be uploaded in parallel as with files. Because there is additional network communication, small uploads are still recommended to use a single connection for the upload.
multipartUploadThreshold
- Threshold in which multipart uploads will be performed.public final TransferManagerBuilder withMultipartUploadThreshold(Long multipartUploadThreshold)
Multipart uploads are easier to recover from and also potentially faster than single part uploads, especially when the upload parts can be uploaded in parallel as with files. Because there is additional network communication, small uploads are still recommended to use a single connection for the upload.
multipartUploadThreshold
- Threshold in which multipart uploads will be performed.public final Long getMultipartCopyThreshold()
public final void setMultipartCopyThreshold(Long multipartCopyThreshold)
multipartCopyThreshold
- Threshold in which multipart copies will be performed.public final TransferManagerBuilder withMultipartCopyThreshold(Long multipartCopyThreshold)
multipartCopyThreshold
- Threshold in which multipart copies will be performed.public final Long getMultipartCopyPartSize()
public final void setMultipartCopyPartSize(Long multipartCopyPartSize)
multipartCopyPartSize
- New minimum threshold for copy part sizepublic final TransferManagerBuilder withMultipartCopyPartSize(Long multipartCopyPartSize)
multipartCopyPartSize
- New minimum threshold for copy part sizepublic Boolean isDisableParallelDownloads()
TransferManager automatically detects and downloads a multipart object in parallel. Setting this option to true will disable parallel downloads.
During parallel downloads, each part is downloaded to a temporary file, gets merged into the final destination file and will be deleted. These temporary files uses disk space temporarily. Disable parallel downloads if your system do not have enough space to store these files during download.
Disabling parallel downloads might reduce performance for large files.
public void setDisableParallelDownloads(Boolean disableParallelDownloads)
TransferManager automatically detects and downloads a multipart object in parallel. Setting this option to true will disable parallel downloads.
During parallel downloads, each part is downloaded to a temporary file, gets merged into the final destination file and will be deleted. These temporary files uses disk space temporarily. Disable parallel downloads if your system do not have enough space to store these files during download.
Disabling parallel downloads might reduce performance for large files.
disableParallelDownloads
- boolean value to disable parallel downloads.public TransferManagerBuilder withDisableParallelDownloads(Boolean disableParallelDownloads)
TransferManager automatically detects and downloads a multipart object in parallel. Setting this option to true will disable parallel downloads.
During parallel downloads, each part is downloaded to a temporary file, gets merged into the final destination file and will be deleted. These temporary files uses disk space temporarily. Disable parallel downloads if your system do not have enough space to store these files during download.
Disabling parallel downloads might reduce performance for large files.
disableParallelDownloads
- boolean value to disable parallel downloads.public TransferManagerBuilder disableParallelDownloads()
setDisableParallelDownloads(Boolean)
Disabling parallel downloads might reduce performance for large files.
public boolean getAlwaysCalculateMultipartMd5()
For instance, if a bucket is enabled for Object Locking, put requests for objects and object parts must contain an MD5 digest. Since Transfer Manager operates on a whole object, the user cannot supply the MD5 digest directly if multipart uploads are in effect.
Supplying any object locking parameter also instructs Transfer Manager to calculate MD5 for parts. This flag should be used in instances where they are not present.
public void setAlwaysCalculateMultipartMd5(boolean alwaysCalculateMultipartMd5)
For instance, if a bucket is enabled for Object Locking, put requests for objects and object parts must contain an MD5 digest. Since Transfer Manager operates on a whole object, the user cannot supply the MD5 digest directly if multipart uploads are in effect.
Supplying any object locking parameter also instructs Transfer Manager to calculate MD5 for parts. This flag should be used in instances where they are not present.
public TransferManagerBuilder withAlwaysCalculateMultipartMd5(boolean alwaysCalculateMultipartMd5)
For instance, if a bucket is enabled for Object Locking, put requests for objects and object parts must contain an MD5 digest. Since Transfer Manager operates on a whole object, the user cannot supply the MD5 digest directly if multipart uploads are in effect.
Supplying any object locking parameter also instructs Transfer Manager to calculate MD5 for parts. This flag should be used in instances where they are not present.
public final TransferManager build()
Copyright © 2021. All rights reserved.