[jboss-user] [Beginners Corner] - Re: Parallel processing in a JBoss app?

mjhammel do-not-reply at jboss.com
Thu Jan 17 15:20:11 EST 2008


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/Server_Configuration_Guide/beta422/html/Additional_Services-Scheduling_Tasks.html for more information on scheduling tasks in JBOSS.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121089#4121089

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121089



More information about the jboss-user mailing list