• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Lock (-1)

 
Duane Riech
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question for locking the entire database lock(-1).
I have my individual record locking code working fine using LockManager[record].wait() and LockManager[record].notifyAll() while
synchronizing on the specific LockManager[record] record.
To lock the entire
database, would it be alright to issue waits on each record, via the LockManager
class array, i.e. LockManager[record].wait(). Then as the records become available,
lock them.
Is there any chance of deadlock??
I've been hashing this over for so long, I'm afraid I can't see the forest for
the trees....

Thanks....
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I don't understand you use of the LockManger as an Array.
The implementation that we go through in lock(-1), is to loop through each record and call lock(currentRecordNumber) as you go through each one.
Now in some have included a boolean variable to hold whether lock(-1) has been called to stop users from getting locks and making it faster that way, I think.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic