In one of my classes called from a DAO class in Hibernate, I send an email using the standard Javax mail.
The problem is that the class code is blocking (waiting, synchronously) on the 'Transport.send(message)' and causing delays -- the browser page doesn't fully refresh until the email is sent.
Would a solution to this problem be to create another thread from that DAO class and send the email using that new thread or is there some async way to use the 'Transport.send(message)' that I haven't seen?
Thanks for any advice or suggestions!
Joined: Feb 18, 2008
is there some async way to use the 'Transport.send(message)'
None that I know of in JavaMail, but I have used JMS - the e-mail is queued to be sent, and a MDB sends the mail asynchronously. A separate thread is a solution, too, of course.
Joined: Jul 12, 2002
Perhaps if I made the call for sending the email from the browser, it would handle the multitasking better than making the call from a java program.