Hi, I have a general question on how a servlet is invoked by multiple requests. Are these requests each a thread that all have access to the same <i>instance</i> of the servlet? If that's the case, can we consider a servlet also a implicit Runnable or Thread? Thanks!
Hi, my point is that all requests access the same instance of the servlet?
Joined: Jan 07, 1999
Not necessarily. In most servlet containers they probably do use the same instance, (unless the serlvet is marked as SingleThreadMode), but the spec makes no guarantee about that, and allows container authors to use any strategy they feel is appropriate - single instance, multiple instance in the same JVM, multiple instances in different JVMs, multiple instances on separate machines and so on ...
Joined: May 05, 2000
Exactly! A well designed server may, for example, create multiple instances of a servlet to handle server load.