开发者

How do you execute cleanup code on shutdown in Resin? [duplicate]

This question already has an answer here: Us开发者_如何转开发ing special auto start servlet to initialize on startup and share application data (1 answer) Closed 7 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜