Hi, ranchers: I want to clean up stale clients, and also strictly stick to the requirements. As api says, Connection object only needs to extends Unreferenced to do the job. Is that it? Do we need to do anything more to take care of this while not concerning about abnormal client crashes? Thanks.
Unless you decrease java.rmi.dgc.leaseValue and sun.rmi.dgc.checkInterval the time it takes for Unreferenced.unreferenced() to be called for a remote object being referenced by an abnormally crashed client will be 15 minutes (I think). I think this is too long to be acceptable in a production application. If you shorten them too much, you will create extra network traffic that may affect performance. I remember Sai suggested writing a thread that periodically checks for abnormally crashed clients. I have also seen folks get high scores without accounting for abnormally crashed clients. Personally, I don't think I'm going to do anything besides Unreferneced. If I am asked about it I will explain that the requirements don't call for it, and I am deferring it to release 1.x. Do you whatever you want, but just have a good reason for it and you will be fine.
Implementing Unreferenced is enough for this assignment as long as are willing to reduce the lease time to reasonable value. I had a cleanup thread in addition to Unreferenced which wakes up every 30 seconds to release the unused locks.