This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
we have contextDestroyed contextInitialized in ServletContextListener. Now questions are --
a) when server is restarted, contextInitialized will be called; when server is shut down, contextDestroyed is called, right ? b) when web application is redeployed, both contextDestroyed and contextInitialized will be called, right ? (old one is destroyed and new one is initiated) c) wehn web app is undeployed, contextDestroyed is called, right ?
any other scenario that may cause either one to be called ?
A very easy way to test your assumptions would be to put a System.out.println statement in both of your methods and watch your logs as you start, stop, and restart your application.
If you're lucky enough to be working on a Unix box, tail -f <filename> will allow you to follow your log file as you are hitting your app. If you're on Windows some text editors (Textpad is one) have settings to automatically refresh the window if the file is updated.