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 ]