Mukesh Garg wrote:

>  Can anybody please help me how do i make use of Threading in
> Servlets My problem is My servlets is being made to handle thousands
> of request to send a mail.I have implemented an SMTPClient class that
> sends mail for every request. Now what I want is I launch a new thread
> for every request for sending mailso that servlets serves each client
> at the same time What would be the best approach for thisand what are
> the issues which need to be take care of to make it Thread safe. Thanx
> and Regards Mueksh garg

Why do you need an extra thread for this?  Each request being processed
simultaneously already has its own thread, so you can do all the sending
simultaneously as long as you do all your mail processing within the
code that is generating your response.  Of course, your SMTP client
class needs to be thread safe, and not have places where you lock out
simultaneous callers for long periods of time, but that would be true
even if you did create your own threads.

Craig McClanahan

PS:  If you wrote your own SMTP protocol handling instead of using
JavaMail, you are working too hard.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to