----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Parul,

Your understanding of SingleThreadModel is a little off. Normally, a
servlet class is instantiated by the servlet engine JVM only once, the
first time it is needed. All subsequent requests to the servlet use the
same instance of the class in memory. When a servlet implements the
SingleThreadModel, it tells the JVM "create a new copy of me in memory
for every request". This can be useful if the servlet has some global
variables that might get modified if different requests to the servlet
were all using the same copy in memory (with JDK 1.2 you can get around
this by using ThreadLocal variables).

So a the servlet engine will create a new thread each time it gets a
request for a servlet that implements SingleThreadModel. I haven't used
SingleThreadModel with JServe, but I imagine that the number of threads
specified in the zone.properties determines the size of the initial pool
of threads for SingleThreadModel servlets. So if MyServlet implements
SingleThreadModel, and the number of threads is 5 in zone.properties,
the JVM will create 5 copies of the servlet initially and add more as
needed.

So anyway, unless you need to protect global variables from being
modified by different requests, you probably don't want to use
SingleThreadModel.

-Steve

> Hi
> 
> I am using Apache 1.3.9, Jserv on Redhat 6.0.
> As I understand, Single thread model means only one single therad wil
> process all the requests in teh webserver.
> But even though I make my servlet to implement STM, I see different thread
> ids for each request - what does this mean?
> Also what do the single thread model - number of threads mean in
> zone.properties file!!
> 
> What do i have to do to have a completely serial access to my data??
> Where do I specify the number of connections that the server can acept
> while waiting to fulfill previous request?
> 
> Thanks in advance
> Parul

-- 
Stephen A. Weiss  Association of American Medical Colleges
(202)828-0428     mailto:[EMAIL PROTECTED]    http://www.aamc.org


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to