Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about ServletContextListener

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you've got it.

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic