I'll explain this from the beginning. If this is dumbing it down too much for you i appologise but it's a concept that took me a while to get hold of.
For the sake of efficiency, there is only ever one instance of each
Servlet. If you have 3 servlets: BobServlet, JohnServlet, BettyServlet, you will have a total of 3 servlet instances running. Ever.
When a request (on its own execution thread) comes in, the application server gets a reference to the required servlet and calls it with the parameters. Other requests could be part of the way through execution inside the SAME SERVLET INSTANCE.
If you have any instance variable associated with a servlet then it is not thread-safe, since any request could change an instance variable that another request is relying on.
The easiest way to get around this is to never have any instance variables or always think of them as static.
If you absolutely need to have instance variables and Thread safety, you can implement the SingleThreadModel. This acts as a flag to the app server that only a single thread should be allowed to access a servlet instance at a time.
The difference between this and synchronising the service method is that initially the app server only has one instance of the servlet.
If you use the synchronised (second time for the Australian spelling

) solution then only one request can be serviced for that servlet at a time and the rest get blocked.
If you use the SingleThreadModel solution it is possible that the same thing happens, but it also allows the possibility (and this is the way I'd try it) for the application server to notice the SingleThreadModel and create multiple instances so that many requests can be served on the servlet without interfering wiith each other.
I think this is correct. There's a nice link to a page at sun on Thread-Safe servlets but I can't find it at the moment. Hopefully someone else can drop it for us.
Dave.