Title: RE: Servlet Life Cycle - Single Thread Model
You're right, thanks for ur info.  I also find the quoted below from http://java.sun.com/products/servlet/2.2/javadoc/index.html
But, what is the meaning of "The servlet container can make this guarantee by synchronizing access to a single instance of the servlet, or by maintaining a pool of servlet instances and dispatching each new request to a free servlet."? 
 
Does it mean multiple instances were created (Dynamically??) under server control? Any parameter to set, if any, this value, say in jserv with apache?
Quoted:
public abstract interface SingleThreadModel

Ensures that servlets handle only one request at a time. This interface has no methods.

If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method. The servlet container can make this guarantee by synchronizing access to a single instance of the servlet, or by maintaining a pool of servlet instances and dispatching each new request to a free servlet.

If a servlet implements this interface, the servlet will be thread safe. However, this interface does not prevent synchronization problems that result from servlets accessing shared resources such as static class variables or classes outside the scope of the servlet. ----- Original Message -----

Sent: Monday, November 08, 1999 6:30 PM
Subject: Re: Servlet Life Cycle - Single Thread Model

Hello all,

If servlet implements SingleThreadModel, it means that it will serve only 1 request at a time. All other request must have to wait for that servlet to finish the first request (like the way synchronization do). It'll never create new instance of requested servlet to serve the request. Then if servlet A implements SingleThreadModel and there're 10 request to servlet A. The requests must be handle in serial order with only 1 instance of servlet A. (It has no different from general servlet except that it can handle only 1 request at a time)

In other case, servlet never unload (I think in every servlet engine) except that servlet engine allow you to unload it manually (WebLogic can).

Hope this helps,
Siros

> -----Original Message-----
> From: Joe Lei [mailto:[EMAIL PROTECTED]]
> Sent: Monday, November 08, 1999 4:46 PM
> To: [EMAIL PROTECTED]
> Subject: Servlet Life Cycle - Single Thread Model
>
>
> Dear Wisers
>
> I've a question on SingleThreadModel Servlet.
>
> In a non-SingleThreadModel, Servlet instance need not to be
> reloaded (or killed) until the engine restart or old version
> of servlet is replaced.
>
> How about servlet implements SingleThreadModel, is the
> servlet instance being clean up after the invoked thread
> stops?  If not, does it mean the no. of servlet instance
> remains in the highest watermark of the instances invoked?
> (For example, if 10 instances has been invoked in earlier
> time at the same instant, even though only 5 users is now
> connected, the no. of servlet instance still remains in 10?)
>
> Thanks
> Joe

Reply via email to