嵌入式 Jetty 服务器是否保证“做好业务准备”?当对 Server.start() 的调用返回时?

发布于 2024-10-08 01:01:21 字数 160 浏览 0 评论 0原文

我无法找到有关嵌入式 Jetty 服务器是否保证在对 Server.start() 的调用返回时完全初始化并准备好接收请求的任何信息。

我也无法通过调试找到任何结论。

如果在调用返回时服务器可能仍在初始化自身,是否有任何方法可以注册回调,以便在它确实准备好执行操作时通知我?

I am having trouble finding any information about whether an embedded Jetty Server is guaranteed to be fully initialized and ready to receive requests when the call to Server.start() returns.

Nor have I been able to find anything conclusive by debugging.

If the server might still be initializing itself when the call returns, is there any way to register a callback so that I can be notified when it is indeed ready for action?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

死开点丶别碍眼 2024-10-15 01:01:21

是的,当从 Server.start() 返回时,服务器已准备就绪。

您可以使用 Server.addLifeCycleListener(listener) 注册 LifeCycle.Listener 来获取启动或关闭事件的通知。如果您查看 Server.start() 的源代码,您会发现它在最后调用了 Listener.lifeCycleStarted() 。

Yes, when returning from Server.start() the server is ready.

You can register a LifeCycle.Listener using Server.addLifeCycleListener(listener) to get notified of startup or shutdown events. If you look at the source of Server.start() you'll see, that it calls Listener.lifeCycleStarted() at the end.

¢蛋碎的人ぎ生 2024-10-15 01:01:21

不是一个完整的答案,但也许这取决于 servlet 是否“在启动时加载”?

not a complete answer but maybe it depends on whether the servlets may or may not "load on startup"?

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