title: contextDestroyed() vs addShutdownHook()
body: <p>I'm currently implementing <code>ServletContextListener</code> and using <a href="http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/ServletContextListener.html#contextDestroyed%28javax.servlet.ServletContextEvent%29" rel="noreferrer"><code>contextDestroyed()</code></a> to run cleanup tasks on my web application before it shuts down.  However, I've been reading about how <a href="http://download.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29" rel="noreferrer"><code>Runtime.addShutdownHook(Thread)</code></a> can be used for the same purpose.</p>
  
  <p>Is there any difference between these two methods of running cleanup before undeployment? Which is preferable for a web application, in terms of functionality, efficiency, and maintainability?</p>