开发者

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

开发者 https://www.devze.com 2023-01-06 22:25 出处:网络
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

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

精彩评论

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