tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Langer" <>
Subject Are static vars VM dependend or ClassLoader dependend [offtopic]
Date Wed, 19 Jun 2002 11:14:07 GMT

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
The static variable implementing the singleton is used by more than one
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 for that deny it??

Thank you very much in advance

Stefan Langer

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message