• 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

ReadWriteLock in I/O Access

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi All,

should we should instance of ReadWriteLock before reading or updating any record in db file like denny'dvd project ?

private static ReadWriteLock recordNumbersLock = new ReentrantReadWriteLock();


before accessing any record should we do like this

recordNumbersLock.writeLock().lock();

and after accessing should we do like this

recordNumbersLock.writeLock().unlock();


is it okay to use ReadWriteLock ?


thanks
pramod
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pramod.

I suggest you take some time reading posts in this forum about such matters. There are lots of posts on locking including some on the current page.
Just expend some effort to read these first and your questions may be less generalized.

Thanks Kevin.
 
reply
    Bookmark Topic Watch Topic
  • New Topic