Howdy, >> When the $CATALINA_HOME/bin/shutdown.sh script is called I would like a >> particular web application to release its resources cleanly and perform >tidy > > >> > You could implement a ServletContextListener. The contextDestroyed() >method >> > will be called when your application is about to be removed. > >If you have a servlet which initializes resource for your context (like >an InitServlet), you can simply implemnent the "destroy" method to >release your resources. > >This may be easier than writing a ServletContextListener, and has fewer >moving parts.
I would strongly disagree ;) The container is free to destroy and reload any servlet, including load-on-startup servlets, at any time it deems such action necessary. If you need something done on shutdown or startup or both, it's much cleaner to write a listener for that purpose than a servlet, for multiple reasons: - The footprint of a servlet in memory is bigger - Another servlet adds to request mapping overhead, reducing performance - Servlets are not supposed to be written only for init/destroy functionality, ServletContextListeners are expressly designed for this purpose - It's a lot easier to mess up thread-safety in a servlet (which of course may have multiple instances in memory) than in a listener The moving parts claim you make -- I'm not sure I understand that. Mind elaborating? ;) Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]