RMI 问题:服务器宕机后对象引用会发生什么情况?
有人可以帮忙吗?
问:应用程序服务器通过调用 Naming.rebind() 在 RMI 注册表中注册对象。一段时间后,服务器应用程序崩溃了。解释一下在注册表中注册的对象引用会发生什么。
答:我认为引用会在注册表中保留一段时间,但在那段时间(“租用期”?)之后,本地垃圾收集器可以删除该引用。
我不知道“租赁期”概念是否只对客户端有效(使用脏调用和干净调用),所以也许我误解了 rmi 来源......
Could someone help on this , please?
Q: An application server registers an object in RMI Registry by calling Naming.rebind(). After a while, the server app goes down. Explain what will happen to the object reference registered in the Registry.
A: I think the reference is kept in the Registry for a while, but after that period ("lease period" ?) the local garbage collector can remove the reference.
I don't know if the "lease period" concept is only valid for clients (using dirty and clean calls), so maybe I misunderstood the rmi sources...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的答案不正确。 DGC 租约到期不会导致远程对象从注册表中删除。该条目将永远保留在注册表中,或者直到注册表退出或有人将其解除绑定。
实际发生的情况是存根“变得陈旧”。客户端仍然可以在注册表中查找它,或者保留他们已有的,但任何使用它的尝试(即通过它调用远程方法)都将引发
NoSuchObjectException
,如果服务器 JVM仍在运行,否则出现ConnectException
。Your answer is incorrect. DGC lease expiry doesn't cause a remote object to be removed from the Registry. The entry will stay in the Registry forever, or until the Registry exits, or somebody unbinds it.
What actually happens is that the stub 'becomes stale'. Clients can still look it up in the Registry, or keep the one they already have, but any attempt to use it (i.e. call a remote method via it) will provoke a
NoSuchObjectException
, if the server JVM is still running, otherwise aConnectException
.