RMI:检查客户端崩溃
我正在使用 Java-RMI 编写一个简单的客户端/服务器应用程序。我想知道所有客户端何时死亡,以便关闭服务器。在网上做了一些研究后,我发现我可以让我的服务器实现 Unreferenced 接口并定义 unreferenced() 方法。但这似乎不起作用,我认为这是因为服务器绑定到 RMI 注册表,该注册表可能保存了对它的引用。
有人知道当我的案例中所有客户端都崩溃时我如何收到通知吗?
谢谢
I am programming a simple client/server application using Java-RMI. I would like to know when all clients died, in order to shut the server down. After having done some research on the web, I found out that I could make my server implement the Unreferenced interface and define the unreferenced() method. But this seems not to work, and I think it is because the server is bound to the RMI-Registry, which probably holds a reference on it.
Does anybody have an idea of how I could get notified when all clients crashed in my case?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是对的,RMIRegistry 也算作 DGC/Unreferenced 目的的客户端。
You are correct, the RMIRegistry also counts as a client for DGC/Unreferenced purposes.