This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The normal servlet behavior is that multiple simultaneous requests are dispatched to multiple threads concurrently accessing the same servlet instance. If a servlet implements the SingleThreadModel interface (which is a marker interface like Serializable), the system guarantees that there will not be simultaneous access to the same servlet instance.
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
hai, Default value of "thread safe = true". servlet or JSP file may be accessed by multiple users.. servlet engine creates a separate thread for each and evry user. if u don't want your sevlet to be accesed by multiple users at a time, you have to implement the servlet class with "singlethreadmodel" interface.This interface does not contain any methods.It is just a flag. In JSP,You have to set threadsafe as false Thanx. Prabu.U
Hi Prabhu I would like to clarify my doubt with you regarding SingleThreadModel. In case of Servlet class which implements, SingleThreadModel you said that Servlet will not be accessed by two threads at a time. What I know that, In case of SingleThreadModel, we can create a pool of Instances which can be used for managing the client requests. We can also set the number of Instances to be created and one instances can be dedicated to one request. If more request come then , it will be put in Wait state. My question is that we can create pool of instances which can be used not like one servlet instance. Please clarify. Thanks Rakesh