How can I know when my tomcat web app is suspended?
3 answers
A servlet that doesn't respond to anything destroy()
is functional, but a bit hacky. Servlets are designed to handle web requests.
The right thing to do is to implement ServletContextListener and make your wrapper in the method contextDestroyed()
.
Register ServletContextListener
yours in web.xml, for example:
<listener>
<listener-class>com.foo.MyListener</listener-class>
</listener>
+4
source to share