----- Original Message -----
From: "Bo Xu" <[EMAIL PROTECTED]>


>   *  SingleThreadModel is non_multi-thread: so it is thread-safty but it
is not
>        multi-thread-safty.  But we also can think it is the safest way of
>       multi-thread-safty :-)

Single thread model is thread safe for the member variables of a class, but
as the container *may* instantiate more than one instance, it is not thread
safe for static variables, if any. Another fallback of this is if you are
using a non static member variable, each instance will have it's own copy
which may cause some problems e.g. if you used it to keep count of the
number of hits.

 >    *  I guess if we use SingleThreadModel, the Servlet container
 >        will have to work *harder*, and the efficacy is lower(because
 >        now for a Servelt class which implements SingleThreadModel,
 >        at any time, only zero/one client can access it ). and from
several
 >        emails, it is not good to use SingleThreadModel in a *real
 >        system*-> it is for testing(?) or other purpose.

In a real environment, there can be N number of requests being processed
simultaneously by a servlet (each being a seperate thread). But if you use
SingleThreadModel, you limit the number of simultaneous request being
processed to the number of instances created by the container, which can
even be 1 !.



> Bo

Regds,
Gokul

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to