Class S3ClientCache
java.lang.Object
com.amazonaws.services.dynamodbv2.datamodeling.S3ClientCache
A smart Map for
AmazonS3
objects. S3ClientCache
keeps the
clients organized by region, and if provided AWSCredentials
will
create clients on the fly. Otherwise it just return clients given to it with
useClient(AmazonS3)
.-
Method Summary
Modifier and TypeMethodDescriptionReturns a client for the requested region, or throws an exception when unable.getTransferManager
(Region region) Returns aTransferManager
for the given region, or throws an exception when unable.void
Force the client cache to provide a certain client for the region which that client is configured.
-
Method Details
-
useClient
Force the client cache to provide a certain client for the region which that client is configured. This can be useful to provide clients with differentS3ClientOptions
or use aAmazonS3EncryptionClient
in place of a regular client. Using a new client will also forcibly shut down anyTransferManager
that has been instantiated with that client, with theTransferManager.shutdownNow()
method.- Parameters:
client
- AnAmazonS3
to use in the cache. Its region will be detected automatically.
-
getClient
Returns a client for the requested region, or throws an exception when unable.- Parameters:
s3region
- The region the returnedAmazonS3
will be configured to use.- Returns:
- A client for the given region from the cache, either instantiated
automatically from the provided
AWSCredentials
or provided withuseClient(AmazonS3)
. - Throws:
IllegalArgumentException
- When a region is requested that has not been provided to the cache withuseClient(AmazonS3)
, and the cache has noAWSCredentials
with which a client may be instantiated.
-
getTransferManager
Returns aTransferManager
for the given region, or throws an exception when unable. The returnedTransferManager
will always be instantiated from whateverAmazonS3
is in the cache, whether provided withuseClient(AmazonS3)
or instantiated automatically fromAWSCredentials
. AnyTransferManager
returned could be shut down if a new underlyingAmazonS3
is provided withuseClient(AmazonS3)
.- Parameters:
region
- The region the returnedTransferManager
will be configured to use.- Returns:
- A transfer manager for the given region from the cache, or one
instantiated automatically from any existing
AmazonS3
,
-