I won't call myself experienced, just entagled. However, you don't want to use a
separate thread here. Instead, have the incoming request/action posted to a db table and
then use a Schedulable class that checks once a minute (or whatever time period you like)
to see what emails need to be sent, to whom and with what content in response to the
request/action. Since the email doesn't have to go out immediately, this mechanism is
better suited to your needs than threads.
I just implemented my first Schedulable and it was rather simple (though I'm using
EJB3.0 I haven't got injection working so I have to get my EntityManager and it's
ilk manually). Once you have the schedulable querying the db, you can probably use JMS or
Java Mail to send the mail messages.
Using a schedulable removes the need for threading in your app and leaves threading issues
to the application server.
See
http://labs.jboss.com/file-access/default/members/jbossas/freezone/docs/S...
for more information on scheduling tasks in JBOSS.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121089#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...