This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cleaning up for classes in common/lib or shared/lib

 
Tushar Madhukar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a scenario where there are several contexts running in the Tomcat container and all are using a few common classes, which are in JAR files in shared/lib directory.

I want to do some clean up in these shared classes before Tomcat is shut down e.g. there are open DB connections, threads running etc. I need to close them properly before Tomcat stops. How can this be done? Can my shared classes provide callbacks, which can be invoked by Tomcat? Basically, I am looking for something like ServletContextListener.contextDestroyed() method for shared classes.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic