Peter's explanation is right on target, although strictly speaking java.lang.Comparable and java.lang.Runnable do define methods.
Whenever I see SingleThreadModel, however, the red flags go up. Almost invariably it is an attempt to plug holes in a faulty design. The only real advantage of SingleThreadModel (or the equivalent
JSP page directive isThreadSafe="false") is that it prevents two requests from modifying an instance variable at the same time. But you shouldn't be using instance variables in a servlet anyway - there is no reason to do so. You can use local variables within the doGet() method and they will be automatically threadsafe.
In other words, instead of this:
do this:
If you need to pass a number of local variables between subroutines, you can define a structure class to hold them, define a local variable of that type, and pass that as a parameter between methods:
If you think you need to use instance variables for database connections or other things that need to persist between requests, you are headed for trouble. What you probably want is an HTTP session, instead.
At the heart of the problem is that SingleThreadModel results in multiple instances of the servlet running, each with a single
thread. The default threading model has a single instance of the servlet and multiple threads running it. If you have an external resource like a database, and you need to synchronize access to it, SingleThreadModel will not have any effect other than to slow everything down.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference Instant Java Servlets