Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet implementing SingleThreadModel thread safe ?

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


In many mock exams,I have seen questions where it is asked if MyServlet is thread safe? Some of them provide answer as yes and some as no.

I think answer is no because container might create multiple instance of the servlet and hence it cannot be thread safe(a particular instance of the servlet is thread safe but not the servlet itslef), am I right?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what the mock considers as not being thread safe. Servlet instance members ? HttpSession ? ... the answer(yes/no) will depend on what the mock is asking. Note that the SingleThreadModel is deprecated, and is not asked at the exam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic