• Post Reply Bookmark Topic Watch Topic
  • New Topic

ReadWriteLock in I/O Access  RSS feed

 
pramod karnani
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • 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
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!