Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Tomcat Shutdown

  Asked By: Egidius    Date: Jan 21    Category: Java    Views: 633

How can one force tomcat to call a method of a deployed application while shutdown? Reason for doing that is to release some objects.



2 Answers Found

Answer #1    Answered By: Corey Brown     Answered On: Jan 21

You can use a ServletContextListener for this purpose and implement
its contextDestroyed method. For a thorough tutorial you may want to
consult the following OnJava article:


Answer #2    Answered By: Fred Hicks     Answered On: Jan 21

Catalina has a shutdown  hook which I have never happened to use but
you should be able to find it on the net. Google is our friend, right?

The other way is to use the
ServletContextListener.contextDestroyed(...) method. I like this one
more. Not I don't like Catalina but you don't want to depent on a
specific server.

Didn't find what you were looking for? Find more on Tomcat Shutdown Or get search suggestion and latest updates.