tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MacLaren, Donald" <DMacLa...@cmgi.com>
Subject RE: A threading question!
Date Wed, 05 Jul 2000 16:45:17 GMT
I used that same type of process except I had a class that was created in a
servlet create the thread and send the e-mail.

I found that this was the fastest and efficient way to send the mail
notification without a delay in the response.



-----Original Message-----
From: Graham Stewart [mailto:GrahamStewart@btinternet.com]
Sent: Wednesday, July 05, 2000 12:37 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: A threading question!


John

>>Typically servlets should not spawn other threads.
Can you elaborate - I've just started using servlets and have lots to learn.
I currently have a servlet that spawns a thread to send email notofication.
I didn't want the
client to have to wait for the email processing to finish before sending
back a response.
Is this an OK thing to do?

thanks

Graham

----- Original Message -----
From: John Econopouly <johneco@hotmail.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Wednesday, July 05, 2000 5:19 PM
Subject: Re: A threading question!


>
> >From: William Brogden <wbrogden@bga.com>
> >Lucas Ludvig wrote:
> > > Can Tomcat handle threads that send output to two separate
> > > HttpServletResponse objects "simultaneously"?  Currently my simple
> >threaded
> > > program locks up and no output appears in the browser.  Any input
> > > appreciated greatly.
> > >
> >
> >Certainly, thats the whole idea. The servlet engine activates a
> >separate
> >Thread for each HTTP request so as long as your servlet does not use
> >instance variables there should be no interference. When you say "my
> >simple threaded program" do you mean that you are starting another
> >Thread?
> >Simple servlets typically use the Thread provided by the servlet
> >engine.
>
> I agree with the above comment.  Typically servlets should not spawn
> other threads.  Also, I wanted to caution you not to try to use the
> Response object outside of the service() method of the servlet (doGet()
and
> doPost() are part of service()), as this is undefined.
>
>
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org
>


--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message