I am a servlet learner. If single container creates one instance of a particular servlet,then what happens when the servlet is implemented SingleThread.Is single instance of servlet is enough for this situations?Pl exaplian me. What happens when more requests are coming for the same servlet at the same time?Will that single instance is taking care of all requests?And what the <load-on-startup> tag will make us to do?
The value of an idea lies in the usage of it.
Author and all-around good cowpoke
Joined: Mar 22, 2000
1. SingleThreadModel interface - don't do it, not recommended, was in the original servlet API (I suspect) to help people get started but is now considered a bad idea. 2. Standard servlets - One instance handles all requests by having a separate Thread for each request. That is why we say that you must NOT use servlet instance variables for data specific to a given request. Any number of request Threads can be executing a servlet "at the same time." Thinking about programming this way requires a major re-orientation from thinking about single-user desktop applications. 3. load-on-startup is used to request that the servlet container create an instance of a servlet when the server starts, and control the order in which servlets are created. Bill
subject: Can I restrict number of instances to servlet?