开发者

RMI question: what happens to an object reference after server goes down?

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开发者_StackOverflow中文版 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...


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 a ConnectException.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜