控制 OSGI 关闭中的退出代码
所以我发起了一次干净的 OSGI 关闭 关闭 OSGi 容器(特别是春分点)的最佳方法 我使用bundle.stop()方法来实现相同的目的。 现在问题出现了,如果我调用bundle.stop()以防发生一些严重故障,执行干净关闭意味着我的进程退出代码为0,有什么方法可以从调用bundle.stop()后的进程,以便进程使用者知道这不是正常关闭?
谢谢!
So I initiated a clean OSGI shutdown
Best way to shutdown an OSGi Container (specifically equinox)
I use the bundle.stop() way to achieve the same.
Now the question arises if I call a bundle.stop() in case some critical failure happens, doing a clean shutdown means that I have a process exit code of 0, Is there any way that I can send out a exit code of 1 from the process after invoking a bundle.stop(), so that the process consumer knows that this was not a normal shutdown?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用
org.eclipse.equinox.app.IApplication
接口,它使您能够从start()
方法返回结果,然后将其作为退出返回来自 Java 进程的代码。如果您不想使用这个 API,下面的代码显示了 Equinox 本身如何控制 Java 进程的退出代码:上面的代码不是一一对应的,但它给出了想法。
You should use the
org.eclipse.equinox.app.IApplication
interface, which gives you ability to return a result from thestart()
method, which is then returned as exit code from the Java process. In case you don't want to use this API, the following code, shows how Equinox itself controls the exit code of the Java process:The code above is not taken one for one, but it gives the idea.