I am sure i am posting a question which might be obvious to many, but it is confusing to me :
Are the servlets implementing SingleThreadModel inteface thread safe ?
i found several books and resources which state:
1. Whizlabs SCWCD simulator:
The simplest way to ensure that a servlet is thread safe is to implement the SimpleThreadModel inteface./QUOTE]
2. SCWCD Exam Study Kit:
A false sense of thread safety. Many novice developers think that implementing the SingleThreadModel interface allows them to forget about thread safety altogether.However,implementing this interface does not alleviate the problems associated with sharing the data through common means such as HttpSession and ServletContext because the requests may still be processed simultaneously by multiple instances.
3. The Servlet spec:
...This interface does not prevent synchronization problems that result from servlets accessing shared resources such as static class variables or classes outside the scope of the servlet.
I know that it depends on the context of the example test question, but if i have a generic question on the exam, regarding the thread safety of a servlet implementing the SingleThreadModel interface, what should be my answer?
Thank you for your response !
I would like to clarify that i have no problems understanding the behaviour of the SingleThreadModel interface and the influence of the variables .
My concern is how to answer that question on the exam ...
Any ideas ?