> -----Original Message-----
> From: David Smith [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 17, 2006 10:36 AM
> To: Tomcat Users List
> Subject: Re: Tomcat on a server
> 
> Yes, but....  Tomcat also pools threads and keeps them around between
> requests, recycling as necessary.  The servlet's themselves should avoid
> class instance variables unless they are reset to some known state at
> the beggining or end of every request for this reason.

Class instance variables must be synchronized to be completely safe, or kept
in ThreadLocal objects.  Unless you implement the SingleThreadModel
interface, in which case Tomcat will not run concurrent threads through your
servlet.  Otherwise, two threads can easily get in each other's way
accessing instance variables.


Tim

> 
> --David
> 
> Alan Meyer wrote:
> 
> >>is it possible to have one tomcat running on a server and allow
> >>multiple clients to execute their programs on the tomcat
> >>running on the server without affecting other clients
> >>execution.How can we configure tomcat for this purpose?
> >>
> >>
> >
> >If I understand everything correctly, when Tomcat receives a
> >request it creates a new thread and runs the servlet in that
> >thread that matches the servlet or JSP requested.
> >
> >Multiple requests can be processed concurrently, whether they are
> >requests for the same servlet or for different servlets.
> >
> >Each thread will normally get its own stack for automatically
> >allocated variables and objects.  Depending upon how your program
> >is written however, it is possible for the threads to interfere
> >with each other if they use any static variables - so you must
> >use synchronization if it is required.
> >
> >    Alan
> >
> >Alan Meyer
> >[EMAIL PROTECTED]
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam protection around
> >http://mail.yahoo.com
> >
> >---------------------------------------------------------------------
> >To start a new topic, e-mail: users@tomcat.apache.org
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to