views:

39

answers:

1

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

+1  A: 

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 ConnectionException.

EJP