You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nilesh Bansal <ni...@gmail.com> on 2008/04/29 08:13:54 UTC

Partial context reload

Hi all,

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.

thanks
Nilesh

---------------------------------------------------------------------
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


Re: Partial context reload

Posted by Nilesh Bansal <ni...@gmail.com>.
thanks. are there other app servers, other than tomcat, which may have
similar functionality?

thanks
Nilesh

On Tue, Apr 29, 2008 at 4:41 AM, Peter Crowther
<Pe...@melandra.com> wrote:
> > 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
>
>



-- 
Nilesh Bansal

---------------------------------------------------------------------
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


RE: Partial context reload

Posted by Peter Crowther <Pe...@melandra.com>.
> 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