通过在eclipse中设置断点来调试ServletContextListener.contextDestroyed()

发布于 12-25 19:10 字数 377 浏览 3 评论 0原文

我实现了一个自定义 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彻夜缠绵2025-01-01 19:10:02

仅当您通过打开“服务器”视图并右键单击服务器实例并选择“停止”来正常关闭服务器时,才会调用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文