• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client waiting for lock

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have been testing locking and unlocking and need some opinions on how long should a client wait for lock. I have set up a test client program that randomly locks a record, sleeps for a random time, unlocks the record and repeats the process for a random number of loops. On the last loop there is a 50% chance that the client will not unlock the last record (I know those are ridiculous odds) simulating a client crash. I set up a batch file to start 7 clients and everything works fine. If a client "crashes", eventually the remaining threads will all try to lock the record that the crashing client locked. The problem here is that there is about a 15 minute wait before unreferenced is called on the crashing client's remote object.
Should clients give up on a lock before unreferenced is called? Maybe the client should be given the option to continue or give up? What would a good wait period be before giving up?
Thanks for your opinions
Michael Morris
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According To sun specification you don't have to worry about client crashes, Client should only wait till the record unlocked by the server, record locking should be performed on the server side with the help of seperate class.
Regards
Anurag Mishra
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it really concerns you, you can always use a command line parameter to reduce the RMI DGC lease time (forgot the name of the system property; it's in the RMI docs). But Anurag is right: I wouldn't worry.
- Peter
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys. It is definitely not a requirement to do anything but wait on a long block. Just wanted opinions.
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic