1.

What Is Reentrantreadwritelock In Java Concurrency?

Answer»

ReentrantReadWriteLock is an IMPLEMENTATION of the ReadWriteLock interface which provides a pair of read-write lock.

  • To get a read lock you need to use - RW.readLock().lock();
  • To get a write lock you need to use - rw.writeLock().lock();

Where rw is an object of ReentrantReadWriteLock class.

ReentrantReadWriteLock also allows downgrading from the write lock to a read lock. You can first ACQUIRE a write lock, then the read lock and then RELEASE the write lock.

ReentrantReadWriteLock is an implementation of the ReadWriteLock interface which provides a pair of read-write lock.

Where rw is an object of ReentrantReadWriteLock class.

ReentrantReadWriteLock also allows downgrading from the write lock to a read lock. You can first acquire a write lock, then the read lock and then release the write lock.



Discussion

No Comment Found