Gokul Singh wrote:
>
> Hi,
>
> >  Even worse, there can be multiple copies of not just
> > instances of a servlet class, but multiple copies of the
> > servlet class itself (and thus multiple copies of its class
> > static members)
>
> I am a bit confused over how can there be more than one copy of the class
> static members in one JVM. OK. I know of one way and that is when different
> classloaders are used for loading the same class. But is is not that the
> servlet containers use the same classloader to load classes/servlets in a
> context. So how can we have multiple copies of the class static members.

 Big ol' caveat: I'm not authoritative on this, ask somebody on the
spec committee if you've really got to know with certainty.

 I was trying to be careful to speak in terms of the container,
not just a single servlet context.

 I'm pretty sure every servlet context must have its own classloader.
Two servlets of the same class in different contexts would definitely
need their own set of static members. If you're depending on singletons,
you'd have to take that into account.

 Are we agreeing on this? I'm not sure I read your statement
correctly.


> Are you referring to the fact that the servlets are distributed over
> different JVMs.
>

 I wasn't, but that's a good point.

 Slight correction to my original post: the servlet is not
necessarily init()'ed when it's instantiated. You can instantiate
a servlet object, wait a while, then call init(). You can even
(I think) throw the servlet object away without ever calling init()
at all.


-cks

___________________________________________________________________________
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