Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javax Mail Transport.send(message) is blocking!

 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

- Mike
 
Adam Michalik
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

I'll try that.

Thanks.

-- Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic