I am using this code for uploading directory on S3.
TransferManager transferManager = new TransferManager(s3client);
MultipleFileUpload uploaded = transferManager.uploadDirectory(BUCKET_NAME, "DirectoryName", new File(uploadDirectory), true);
While uploading Directory to Amazon S3 bucket I get the following exception
com.amazonaws.SdkClientException: Upload canceled
    at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:159)
    at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:47)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
This exception generally occur around 10 times in 100 attempt
Note- The above code is executing in Multithreaded environment with the same
s3clientobject
Thanks a lot!
The Solution of above problem i encountered while doing R&D in Java Amazon Sdk. Instead of creating different TransferManager instances for every thread share the same instances with multiple threads if you are using same AmazonS3Client.
It will not cause any issue because it is thread safe object and problem was also solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With