The method is static, but I cannot find mention of if it is thread-safe or not. I plan on hitting this method with several threads at once and I would like to avoid a synchronized block if possible.
javax.mail.Transport.send(msg);
It is usually bad design and a violation of expectations to have a static method that is not thread-safe.
The documentation indeed appears to be devoid of any mention of thread-safety, but a quick glance through the code suggests that the implementation is thread-safe by creating a thread-confined Transport instance on every call and delegating to that.
To be absolutely sure I recommend pulling a couple of days out the calendar for a proper analysis.
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