Originally posted by parthiban subramaniam:
from what i understand .. unreferenced is not meant for a specific client who holds a stub for this rmi object but for the whole .. the unrefrenced method is invoked by the rmi system when the the no of remote client to this rmi object falls to 0 ..then how are your removing record locks which are locked by this client ??
Your understanding is correct about how the RMI runtime determines when to call unreferenced. If you have issued a unique connection to each client then it is obvious which client owns the locks held by the Unreferenced object. There can never be more than one remote reference in such a situation, so when the client dies the reference count falls to 0.
Originally posted by Vishal Sinha:
I have also added a finalize() method which when called also performs the same operation as that of unreferenced.
Bad idea. You don't need a finalize() method. Let GC, DGC and Unreferenced take care of everything for you. Unreferenced is going to called by the DGC anyway, so why do you need finalize()? Just let the object die gracefully when the client connection fails.
Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher