You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stefan Langer <ma...@web.de> on 2002/06/19 15:18:54 UTC

[offtopic] static vars unique to tomcat / JVM or to ServletContext/Classloader

Hello

This is a little off topic. According to documentation each webapplication
is loaded by a different classloader. If I understand this correct that
means each ServletContext is loaded with a different ClassLoader.
In my webapplication I'm using a singleton pattern to load some needed
ressources.
The static variable implementing the singleton is used by more than one
webapplication.
I'd like to know is this singleton a singleton in the ServletContext or is
it a singleton to the JVM? Stated differently is the static variable the
same for each webapplication in the Tomcat instance or does each Context
have its own copy of the static since each context is loaded by a different
classloader. As far as my testing has gotten I think that the static is only
available once in the Tomcat installation.
Can anybody confirm this or deny it??

Thank you very much in advance

Stefan Langer


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>