• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database Lock (-1)

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic