The answer on static variables is actually a little more complicated than "one
per JVM". It depends on how your servlet container uses class loaders in
relationship to your web applications. If everything is loaded by a single
class loader -- the system class loader that reads from the CLASSPATH -- then
"one per JVM" is the correct answer. If your servlet container implements a
separate class loader per web application (commonly done if it supports
auto-reloading), AND if the class that created this static variable is loaded
by the per-application class loader, then the answer is "one per class loader".
Craig McClanahan
Kevin Mukhar wrote:
> Subramaniam Chidambaram wrote:
> >
> > I have a doubt with respect to multi threading property of the servlet.
> > 1. If i instantiate a class A in the class Aservlets , How many instances
> > will be created for N no of requests..
>
> If A is a non-static class member, then one per instance.
> If A is a static class member, then one per JVM.
> If A is local to a method, then one per request.
>
> > 2. How about static variables for a servlet class which spans across
> > multiple jvms.
>
> One per JVM.
>
> ___________________________________________________________________________
> 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
___________________________________________________________________________
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