• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

running a process in background (in separate thread)

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
reply
    Bookmark Topic Watch Topic
  • New Topic