RSS Feed for This PostCurrent Article

Shutdown Hook in Tomcat using ServletContextListener

Normally in my standalone Java program I can add a shutdown hook to the JVM runtime easily. To achieve the same thing in Tomcat, I use ServletContextListener.contextDestroyed method.

If you implemented ServletContextListener, implementations of this interface receive notifications about changes to the servlet context of the web application they are part of. To receive notification events, the implementation class must be configured in the deployment descriptor for the web application.

Trackback URL

Sorry, comments for this entry are closed at this time.