This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes running a process in background (in separate thread) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "running a process in background (in separate thread)" Watch "running a process in background (in separate thread)" New topic
Author

running a process in background (in separate thread)

B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
Hi,
I have a simple situation wherein the user wants to send emails to multiple recipients (that will be looked up from database). The number of recipients is going to be considerable, which means that the whole process will take some time to complete.

Given this scenario, I think the best way to run the "send email" process, would be to run it in a separate thread. Since the J2EE prohibits/discourages creating new threads, I think I will have to use EJB's (either stateless bean marked as @asynchronous, or MessageDriven Bean).

If I am correct in what I said above, which is possibly the best choice for the "send mail" process, asynchronous Stateless Bean or MDB? Also, if I use either of these, how should I notify the user when the process successfully completes or fails.

Another crude thing that came in my mind was to open a new window for the "send mail" option and process the same in that window. But I am not sure about whether, the JSF (or JEE) specs describe the behaviour of one user, multiple windows request processing.

To summarise my doubts,
1. Whether to use EJB or simply create new window and process the "send mail process" in that window.
2. If use of EJB is mandated, whether to use SLSB or MDB
3. If EJB is used, how to notify user of the process success/failure.

regards,
Nirvan.


 
 
subject: running a process in background (in separate thread)
 
Similar Threads
Why pool stateless session beans when you can get by with one instance?
Asynchronous Job withou JMS
Are EJB Methods Synchronized ?
Synchronous & Asynchronous framework
Notifying user using JSF after the Asynchronous session bean method completes