I have my servlet set to: <load-on-startup>1</load-on-startup> and it prints out "Loaded!" when it's loaded. This prints TWICE when I start up the server - why is this? (I'm using tomcat 3.2.3 if it's only with that servlet engine that this occurs)
Robert It may be that the servlet container created more than one instance of your servlet. I believe it may do this if you implement the SingleThreadModel interface, or under some or other condition where it determines that having only one servlet instance to service requests may degrade overall performance. Mark.
Joined: Feb 14, 2001
On further investigation, it appears the container may create multiple servlet instances only if the servlet implements the SingleThreadModel interface.
Joined: Jul 28, 2002
Interesting! 1. How does the SingleThreadedModel vs the alternative affect everything? (for example static variables) 2. How do I set the thread model to use?