tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Crowther <Peter.Crowt...@melandra.com>
Subject RE: Partial context reload
Date Tue, 29 Apr 2008 08:41:00 GMT
> From: Nilesh Bansal [mailto:nileshbansal@gmail.com]
> I have a question regarding context reloading in tomcat. Our app
> consists of two type of Java class files (1) core modules consisting
> of many singletons which are initialized once by reading large files
> from filesystem at the start of application (2) helper classes mostly
> for formatting, e.g., a servlet that serves a PNG graph, formatting of
> time in different formats, and classic JSP tags extending TagSupport.
>
> Tomcat allows users to set "reloadable=true", but that reloads the
> whole context (even if a single class has changed). This means, our
> application has to initialize itself all over again which is time
> consuming (it reads lot of stuff from files in memory). Is there a way
> to set partial reload?? Which means, if one of the helper classes has
> changed (and core classes are intact), just replace that changed code
> in the context.
>
> Any help on this issue will be of great use to us.

There's a hack, but it's pretty gross.  If this is the only webapp on the server, you might
be able to put the jars for the core classes in common/lib.  They would be initialised once,
and context reloads wouldn't reinitialise them.  However, you'd then need to restart Tomcat
to force a reload of the core classes - this is clearly not a solution that's appropriate
for a Tomcat with several webapps on it!

A second approach would be to have two webapps - one with your core and one with your helper
classes.  Change the communication between the two to use some appropriate mechanism that
works between webapps.  You could then reload one webapp independently of the other.

I'm not aware of any facility for a partial reload other than this.

                - Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message