On 14/04/2010 05:22, Godmar Back wrote:
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.
What about the Servlet Spec? v2.3 - 2.5 are actually surprisingly
readable for a spec, sadly the same isn't true of the forthcoming 3.0.
If you haven't read it, then do not pass "Go"...
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?
As Bob suggested, ServletContextListener is the way forwards.
Second, is there a custom API in Tomcat?
Actually yes, but as you might imagine, there are restrictions.
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Lifecycle
Listeners
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?
n/a I guess.
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).
6.0.26?
p
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org