Hi Guys, Do we need to implemet Unreferenced interface for our remote object? and why? Thanks in advance Sam
Michael Morris
Ranch Hand
Joined: Jan 30, 2002
Posts: 3451
posted
0
Hi Sam, Well it depends on whether or not and how you plan to deal with stale clients. Read through (you can actually skip most of it and do a search from your browser for unreferenced) this post and you decide if you need to implement it: Long Thread on Locking Hope this helps, 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
Sam Stackly
Ranch Hand
Joined: May 04, 2002
Posts: 109
posted
0
Michael, The way I did clean the dead client is different.
I create a nested class inside of LockManager to hold objectID, recordNum and the time it received the lock and I have Vector to store or remove that kind of object during lock and unlock, I also create a daemon thread running every 2 second and check if there is any expired object is in Vector then it will clean the dead client and unlock that record too. how do you feel about it ? is that the right design Regards Sam
Michael Morris
Ranch Hand
Joined: Jan 30, 2002
Posts: 3451
posted
0
Hi Sam, It's OK to do it that way, I know that many have taken a similar approach. A couple of points though:
Implementing Unreferenced is a no-brainer
Using a roll-your-own timeout assumes something that may not be true, ie the client may just be taking its own sweet time
But I don't think you'll lose any points for dealing with stale clients in this manner. Hope this helps, Michael Morris
Sam, I'd suggest you use ArrayList instead of Vector. Vector and HashTable is considered the old collections, whereas ArrayList and HashSet are par tof the newer collections objects, the are more light-weight than the older versions. Mark