How do you execute cleanup code on shutdown in Resin? [duplicate]
Is there a way to register a function in Resin so that it runs whenever Resin is shut down? I know you can init servlets on startup, but I need to make sure that all of my exec()'ed processes are terminated when the server is shutdown.
Use a ServletContextListener
to receive notifications about impending shutdown of a web application. You'll need to provide an implementation for the contextDestroyed
method, where you can terminate your processes.
You can also use the ServletContextListener
to perform any startup operations, via it's contextInitialized
method.
精彩评论