嵌入式 Tomcat 6 - 启动后关闭
我想使用嵌入式 Tomcat V6。该代码可以完美运行,但前提是程序正在运行。所以如果没有 Thread.Sleep 它将立即退出,否则继续运行直到时间到。
我怎样才能让嵌入式Tomcat保持活力。 setAwait(true) 应该处理这个问题,不是吗?但我不工作。试图弄清楚更多有关此的信息,但描述中没有任何内容。还有其他想法吗?
I wanna use an embedded Tomcat V6. The code works perfectly, but only as long as the programm is running. So if there is no Thread.Sleep it will exit immediately, otherwiese keep on running till the time is up.
How can I keep the emmbedded Tomcat alive. setAwait(true) should deal with this, shouldn't it? But i does not work. Tried to figure out more about this, but there is nothing in the description. Any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望嵌入式 Tomcat 无限期地运行,您将需要一些代码来处理外部管理请求(例如重新启动、关闭等)。这将进入您的主线程,顺便保持 Tomcat 实例处于活动状态。
If you want your embedded Tomcat to run indefinitively you will need some code to handle outside administrative requests (like restart, shutdown, stuff like that). That will go in your main thread, incidentially keeping the Tomcat instance alive.
这个类应该可以满足您的需求。
This class should do what you are looking for.