This week's book giveaway is in the Performance forum. We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line! See this thread for details.
Hi, Manning book says - "In fact, class variables are unsafe even for the Single Threaded model, because multiple threads may access the same class variable from different servlet instances." So, Single thread model servlets are not really thread safe, are they? Thanks, Aruna.
Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
posted 13 years ago
No, the SingleThreadModel servlets are not always thread safe. Implementing this interface only guarantees that in case of multiple requests, Instead of executing the service() method in more than one thread, the container will create multiple instances of the servlet class. Class variables are common among different instances, therefore multiple threads may access the same class variable from different servlet instances which makes them thread unsafe even though the servlet implements SingleThreadModel. [ February 01, 2003: Message edited by: shweta mathur ]