Jason Collins wrote:

> Thanks for the detailed response, Chris. I only have one
> question remaining. In the Mazzocchi-Fumagalli white paper,
> it says,
>
>   "The servlet engine stores only one instance for each
>    servlet and each request handling thread executes the
>    same method concurrently on the same servlet as
>    specified by the APIs."
>
> I guess where I got into trouble was I assumed this held
> for ALL classes specified by the repositories attribute
> in the .properties file. It sounds like this is NOT true.
> It sounds like JServ creates only one instance of classes
> in the repository that also implement Servlet? (Or is it
> some other criteria?)
>
> Either way, it sounds like this is not the case for
> "general" (i.e., non-servlet) classes in the repositories.
>

For servlet classes, Apache JServ (like most servlet engines) follows these
rules:

* If the servlet class does not implement SingleThreadModel,
  only one instance is created -- it's service() method is
  invoked from multiple threads simultaneously.

* If the servlet class implements SingleThreadModel,
  Apache JServ creates up to the number of instances
  you configure in your zone properties file (default is 5),
  and guarantees that no one instance will have two active
  servlet requests in its service() method at the same time.

For non-servlet classes, absolutely nothing special is done, because JServ has
no clue what the semantics of your classes are.  If your code says to create a
new instance, a new instance is created.  If it doesn't, it isn't.

The only extra feature of running under JServ (or most other servlet engines)
is that you can have automatic class reloading, if you want it, by putting your
classes in the zone classpath and setting the autoreload parameter.

Craig McClanahan




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

Reply via email to