tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <>
Subject RE: Question on static variables
Date Wed, 05 Sep 2007 08:23:40 GMT
> From: Chad Lung [] 
> Coming from ASP.NET experience I know that using
> static variables with IIS they are held in the app domain and 
> the app domain
> can be reloaded by IIS for a number of reasons (config files 
> changed, files
> changed, etc.)  This kinda makes using static variables in 
> ASP.NET and IIS a bit tricky and unreliable.

I know where you're coming from.  We routinely have to warn our clients
about IIS worker process recycling - it's a typical Microsoft approach
to reliability.  "Have you rebooted your application?"

Tomcat will reload a webapp if you have configured it to auto-reload and
it detects changes, or if it's directed to undeploy and redeploy the
webapp.  Tomcat is a single process and individual webapps don't get
recycled, although clearly Tomcat will also reload everything if it
crashes for any reason!

Tomcat will *not* reload classes placed in the common or shared
classloader directories, even if the webapp reloads.  If you're
deploying on servers you manage, that might be the best place to put the
class holding the static(s), as they'll then survive webapp reloads.
I'd be more cautious about doing this if you're creating a webapp for
customers to deploy, as it increases the deployment complexity and the
maintenance complexity.

		- Peter

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message