Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Is it multiple threads problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is it multiple threads problem?" Watch "Is it multiple threads problem?" New topic

Is it multiple threads problem?

Yurong Chen

Joined: Jul 23, 2002
Posts: 18
I am a new beginner here. I am doing a small project about web server design. I meet a problem now.
In one step of my project, after the client submitting request, the server should do two things: one is send the main page back to the client, the other is invoking a algorithm to process the request and send the result to client by email. Is it a multiple threads problem? Should I use java servlet to solve the problem? I only use JSP in my project. Can I use JSP to solve the problem? If Java servlet is the only choice, could you give me some advice to do? I really don't know how to begin?? Thank you in advance!
Yurong Chen
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
When I have done this sort of thing, it is with a separate object having its own Thread that does nothing but send mails. The reason being that your mail process will have to deal with a mail server that may be busy or off line so you can't count on the mail job finishing in a reasonable time for sending a response back to the user.
Your servlet or JSP just hands off the mail information to the separate object.
I agree. Here's the link:
subject: Is it multiple threads problem?
It's not a secret anymore!