Hi,
I am using Spray client within tomcat. I am wondering if any one has ever faced this situation. I need to shutdown my spray client when tomcat is shutdown. However the classic shutdown hook as in
Runtime.getRuntime().addShutdownHook(new Thread() {
override def run() {
println("shutting down spray")
IO(Http) ! Http.CloseAll
IO(Http) ! PoisonPill
system.shutdown();
}
})
Does not work.
I introduce it in my service that actually to rest call to other service that are external from within a tomcat webapp
case class PClassificationService(name: String) extends ClassificationService {
implicit val requestTimeout = Timeout(800 seconds)
implicit val system = ActorSystem("simple-spray-client")
/*Runtime.getRuntime().addShutdownHook(new Thread() {
override def run() {
println("shutting down spray")
IO(Http) ! Http.CloseAll
IO(Http) ! PoisonPill
system.shutdown();
}
})*/
......