2008/9/13 Tom Cat <[EMAIL PROTECTED]>:
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to