On Thu, Sep 30, 2004 at 01:14:26PM -0400, Malia Noori wrote: : I thought Tomcat instantiates only 1 instance of JSP servlet to handle all : requests. Isn't that the reason why it's not suggested to have instance : variables?
Close, but not quite. ;) The servlet spec permits a container to create as many instances of a servlet class as it sees fit. The same goes for creating and destroying a servlet object several times over a context (webapp) lifetime. That said, a servlet's main methods -- doGet(), doPost(), service() -- may be called concurrently for the same servlet object. These methods are thus meant to be thread-safe, and as such they shouldn't modify object instance variables. (It's fine to call such variables, as long as they are read-only or at least treated as such.) : If it is the case that 2 instance of JSP servlets gets created : to handle each request, what's the best object to synchronize on? I missed your original post, so I can say only this: when you find yourself painted into a corner, it's time to revisit the design stage. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]