Search code examples
amazon-web-servicesamazon-s3aws-sdkaws-sdk-java

How to use the Amazon S3 Java API to perform getObject using an asynchronous call


I need to download a lot of files from S3 so I wrapped many calls to s3Client.getObject(request, destination) with futures, but there's no mention of it being blocking so I'm afraid I might run into a race condition where all the download calls were made but the files weren't really downloaded yet.

Is it safe to assume this api is blocking since there's no mention of it being async?

To clarify, by blocking I mean that the flow won't continue after the s3Client.getObject(request, destination) line until the download is finished.

enter image description here


Solution

  • Looking at the code on Github, it is indeed blocking the call (invoke).