tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Godmar Back <god...@gmail.com>
Subject Q: how to obtain notification when a WebApp is unloaded/reloaded?
Date Wed, 14 Apr 2010 04:22:24 GMT
Hi,

I have a simple question I was unable to find an answer to even after 2
hours of reading documentation, APIs, and (partly) Tomcat source code.

In my web application, I'm using the 'reloadable='true'' attribute to
Context to reload the application automatically when a .class or jar files
changes. To avoid a quickly accumulating memory leak, I need to shut down a
service thread my application has started when the web application is
reloaded.

What API function can be used to notify my application that it is about to
be shut down, so that the thread in question can exit?

First, is there a standard API that would work also in other J2EE containers
besides Tomcat?

Second, is there a custom API in Tomcat?

Third, if there is no API that a web application could use by itself, is it
possible to achieve my goal by writing a custom "thread manager" that is
loaded outside the specific web application? If so, are there examples of
how to add such a class to the configuration?

I'm really interested in a solution that would be contained inside the web
application (i.e., first or second above) and that would not require changes
to the server configuration, so that it would work in hosted environments
where I do not control the Tomcat configuration.  I'm using the latest 6.0
release (6.0.20).

Thanks.

 - Godmar

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message