简体   繁体   中英

AWS is sending emails thread safe

Using AmazonSimpleEmailServiceClient.sendEmail() ; as per java docs

All service calls made using this client are blocking, and will not return until the service call completes.

Quick question is, is it thread safe?. Can multiple threads be using same instance of AmazonSimpleEmailServiceClient to call sendEmail() in parallel? Like, suppose, multiple users of my website trying to register on the website concurrently.

This is the answer I got from AWS:

Hi,

You should be able to use the same AmazonSimpleEmailServiceClient() object to send using multiple threads.

Regards, Rohan

I am adding an updated answer since the original one is from 2012 and not very reassuring about the thread safety.

I am not sure in which version it was introduced, but in latest Java AWS SDK version available today (October 2016, version 1.11.43) the class is annotated as @ThreadSafe , so the sendEmail method can be assumed thread safe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM