Java 服务包装器和关机命令
我使用 JSW 来包装 HSQLdb 服务器。 HSQL 文档说我必须连接到服务器并执行“shutdown”命令才能正确终止服务器。当我在服务属性中使用标准服务管理命令(例如“net service stop”或按钮“stop”)时,有什么方法可以从包装器内执行此类关闭命令?
I use JSW to wrap HSQLdb server. HSQL docs say I must connect to server and execute "shutdown" command to terminate server correctly. Is there any way to execute such shutdown command from within wrapper when I use standard service management commands like "net service stop" or button "stop" in service properties?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不太确定您想要完成什么,但假设您正在将 HSQL 服务器作为服务运行,并且您希望从应用程序连接到它,并且当您的应用程序停止时,它也应该停止 HSQL 服务器?
如果是这样,请查看以下页面:
http ://www.informit.com/guides/content.aspx?g=java&seqNum=619
干杯,
编辑:
我认为注册代码以干净地关闭 HSQL 作为关闭挂钩应该对你有用。此外,您还可以使用 WrapperListener.stop 函数执行此操作(遵循集成方法#3< /a>)
干杯,
not quite sure what you are trying to accomplish, but assume that you are running the HSQL server as service and you want to connect from your application to it and when your application stops, it should also stop the HSQL server?
If that's so, then please take a look at the following page:
http://www.informit.com/guides/content.aspx?g=java&seqNum=619
cheers,
edit:
registering the code to cleanly shutdown HSQL as shutdown hook should work for you I think. Furthermore you can also do this with the WrapperListener.stop function (following Integration Method #3)
cheers,