MayoMan
MayoMan

Reputation: 4917

Is my Amazon S3 client synchronous or async?

Here is my code

    import com.amazonaws.services.s3.AmazonS3;
    import com.amazonaws.services.s3.AmazonS3Client;
    
    public class AwsS3Helper
    {
        private AmazonS3 s3Client;
    
        public AwsS3Helper()
        {
            try
            {
                AWSCredentials credentials = new PropertiesCredentials ....
    
                s3Client = new AmazonS3Client( credentials );

                s3Client.putObject(putObjectRequest);

What I would like to know is, is this an asynchronous or synchronous operation? I use DynamoDB and it has 2 different clients, an async and sync one, but I don't see any other S3Client in the Amazon SDK

Upvotes: 10

Views: 14395

Answers (3)

Sony Kadavan
Sony Kadavan

Reputation: 4052

This statement, from the documentation is pointing to a synchronous operation. Moreover it doesnt take any parameter for async indication of the result.

"Amazon S3 never stores partial objects; if during this call an exception wasn't thrown, the entire object was stored." http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3Client.html#putObject(com.amazonaws.services.s3.model.PutObjectRequest)

Upvotes: 7

Robocide
Robocide

Reputation: 6751

as answered it is not Async, although the Sdk has Async clients for other services. this is also confirmed here (https://github.com/aws/aws-sdk-java/issues/140)

but also note that in the new version of the sdk (2.0) you have Async client for s3 (https://github.com/aws/aws-sdk-java-v2).

Upvotes: 3

Related Questions