1

Am I right in assuming that by the time ServletContextListener.contextDestroyed() is called, the respective web application won't be accepting HttpRequests anymore?

If yes, is there any way to be notified of an imminent shutdown while still accepting requests / serving content?

Cpt. Senkfuss
  • 1,347
  • 3
  • 12
  • 20
  • This question doesn't make sense. Why would you want to send new HTTP requests to a server that is trying to shut itself down? There's probably a better way to solve this problem. For folks looking to just save some data / stop a thread, look here: http://stackoverflow.com/questions/1549924/shutdown-hook-for-java-web-application – Ryan Shillington Dec 10 '13 at 15:10
  • 2
    it was meant for our loadbalancer which polls a status page on our app. The idea would be to communicate an imminent shutdown via that page and give the LB enough time to stop routing to the app. given the other problems we have to deal with, this optimization is currently overkill. Thx for commenting, though. – Cpt. Senkfuss Dec 10 '13 at 15:30
  • Ah, ok. Makes more sense. In that case I'd solve it by creating a shutdown script that first contacted the Load Balancer and then called tomcat's shutdown procedure. – Ryan Shillington Dec 10 '13 at 19:55
  • yeah, that was our first idea but the ops shop we work with insists on the LBs *not* being controllable via external APIs. thx again! – Cpt. Senkfuss Dec 11 '13 at 08:36

0 Answers0