通过在eclipse中设置断点来调试ServletContextListener.contextDestroyed()
我实现了一个自定义 ServletContextListener
并将断点放置在 contextInitialized()
和 contextDestroyed()
上。
使用 WTP 启动 Web 应用程序时,调试器可以停止 contextInitialized()
。但是,当我关闭 Web 应用程序时,contextDestroyed()
中的断点不起作用,并且 Web 应用程序只是关闭。是否可以以及如何使用调试器在 Eclipse 中调试 contextDestroyed()
?
我想检查在Web应用程序关闭期间所使用的资源是否可以正常释放。
I implement a custom ServletContextListener
and place the breakpoints on both the contextInitialized()
and contextDestroyed()
.
When starting the web application using WTP , contextInitialized()
can be stopped by the debugger. But when I shut down the web application , the breakpoints in the contextDestroyed()
do not work and the web application just shutdown . Is it possible and how to use debugger to debug contextDestroyed()
in eclipse ?
I want to check if the resource used can be released properly during the shut-down of the web application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

仅当您通过打开“服务器”视图并右键单击服务器实例并选择“停止”来正常关闭服务器时,才会调用
contextDestroyed()
,或者点击“服务器”视图中的红色按钮,其工具提示显示“停止服务器”。当您通过点击工具提示为“终止”的“控制台”视图中的红色按钮来完全终止服务器时,它将不会被调用。终止(杀死)与停止不同。
The
contextDestroyed()
will only be called when you gracefully shuts down the server by opening the Servers view and rightclicking the server instance and choosing Stop, or by hitting the red button in the Servers view whose tooltip says Stop the server.It will not be called when you terminate the server altogether by hitting the red button in the Console view whose tooltip says Terminate. Terminating (killing) is not the same as stopping.