title: Tomcat shutdown hook
body: <p>I'm trying to implement a shutdown hook in a tomcat web app where i have little control. Basically, i have implemented a lib, that use spray rest client, based on actor. I have tried the typical shutdown hook of spray but it did not works. Worst it says that the access to the actor system is illegal, as if everything was shutdown already. </p>
  
  <p>I was wondering if there is specific to tomcat if one wants to call: </p>
  
  <pre><code>Runtime.getRuntime().addShutdownHook(new Thread() {
  
      override def run() {
        println("shutting down spray")
        IO(Http) ! Http.CloseAll
        IO(Http) ! PoisonPill
        system.shutdown();
      }
    })
  </code></pre>