• 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 background process

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to send email from my application. I need to only start the process of sending and return the control. Typically I will call the send mail method from a servlet. So after calling the method, I want to return back to the servlet and continue with rest of the processing.
Any ideas on how to implement this.. Will Thread.setDaemon be useful here..\
 
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use the message driven to implement such function.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to call another thread from servlet, it makes sense for servlet not to wait and return from doPost ( or doGet ) method. The idea of the background processing in servlet is to allow servlet code to return while the background thread will continue. Jason Hunter book on "Java Servlet Programming" has a very good example on servlet background processing which you can use as example.
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't the Servlet API spec prohibit starting Threads? Not that I imagine it would cause much harm...
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Been a while since I looked at the specs. A quick flash through the 2.2 specs (old I know) gives ......
Threads are not prohibited.
Specs say: do not pass references to certain objects (request / response ) to other threads.
Specs say: the container must ensure thread continuity across dispatch.
Guy
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at the 2.4 specs: both of the above 'requirements' are now 'recommendations'.
G.
 
reply
    Bookmark Topic Watch Topic
  • New Topic