How to deal with servlets and thread safety?
A Extend ThreadSafeServlet
B Log all messages
C implenent SingleThreadModel D User exclusively local var and for instance var , synchronize them.
Now I seem two currect answers C and D .But in mock correct answer has been given only D.
So my question is even though interface SingleThreadModel has been deprecated , will it be considered as a valid answer in exam , or it should not count in correct answer options.
singleThreadModel doesn't answer all thread safety problems.
in fact, some implementation creates more problem than they
solve and this is exactly why this interface has been deprecated.
in brief, this interface protect instance variable from concurrent access,
but shared attribute are still not thread safe (context and session attribute,
for example, can be accessed from different servlets. in this case YOU should
take care of thread safety, by locking on the context or the session)