• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please comment on lock method implementation  RSS feed

Sam Stackly
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
After reading lots of thread and comment about lock method I end up with this implementation

1- Check if record numner is -1 then turn on a databaselocking flag and call lockDatabase method
2- If record number is positive then check if databaselocking flag is on then ignore request(I am not sure about this , please comment) and if databaselocking is off call lockRecord method
3- All lockDatabase do is to check if another client has databaseLockOwner object or clients has any lock of any records(looping through all records in hashmap and check for the owner(clientID)), if it's true then wait else assign the clientID to databaseLockOwner
4- lockRecord is a simple method to assign recordlock to client
I tried to make it as simple as I could , your comments will be really appreciated
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!