tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Kolinko" <knst.koli...@gmail.com>
Subject Re: Tomcat shutdown event
Date Sat, 13 Sep 2008 02:32:18 GMT
2008/9/13 Tom Cat <tom.cat2170@gmail.com>:
>
> I have a servlet spawn a thread that should run until tomcat is
> shutdown. The problem is, when Tomcat is shut down, the thread keeps
> running.
>
> Does Tomcat have a shutdown event that I could use to trigger the
> thread destruction? If not, is there any graceful way of handling
> this?
>

You may implement a
o.a.c.LifecycleListener
see
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

Also, the Servlet spec provides the ServletContextListener interface.

Also, Java has support for JVM shutdown hooks.

Also, if you start your own thread you may want to call
Thread.setDaemon(true), because non-demon (default) threads
prevent JVM from shutdown.


Best regards,
Konstantin Kolinko

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