Thanks for the responses.
I tried using ServletContextListener and added my code to the contextDestroyed() method. It never seems to get called. My servlet is listed in web.xml under a <servlet> tag and is initialized just fine. I also saw that there is a destroy() method which seemed like it might be appropriate. When I add my code there is does get called, but it seems to have a varying amount of time to do its work before everything ends. Sometimes I get everything done, sometime nothing, often somewhere in the middle. Any suggestions on how to get either of these working? What am I missing? Is there any better documentation or examples anywhere? Thanks, -- Frank