Originally posted by LIN FENG:
Thank you for your reply. However it seems that the Unreferenced is not strong enough. It will be only called when there are no more clients that reference that object. So it means that if there are still other clients refered to that object , the server will not be notified.
Which is perfectly fine if each client gets its own object. That solves your "how do I track client identity" problem at the same time. If you didn't know you had this problem, examine the javadoc for Data.unlock()

(This is also what Lin was suggesting).
Unreferenced notification has inevitable delays. If the client simply "forgets" about the remote object by releasing all references to it, you'll have to wait for the garbage collector to do its job. If the client crashes, the remote object lease has to expire first (10 mins, but can be changed using a system property). So the preferred method of dispensing with a remote Data remains a call to close().
Personally, I did implement cleanup using Unreferenced, not because I thought it was in any way required but because it added a very useful feature with just 3 lines of code (including method header and closing brace, but not counting comments).
- Peter