ReadWriteLock

This lesson examines the ReadWriteLock interface and the implementing class ReentrantReadWriteLock. The lock is intended to allow multiple readers to read at a time but only allow a single writer to write.

If you are interviewing, consider buying our number#1 course for Java Multithreading Interviews.

The ReadWriteLock interface is part of Java’s java.util.concurrent.locks package. The only implementing class for the interface is ReentrantReadWriteLock. The ReentrantReadWriteLock can be locked by multiple readers at the same time while writer threads have to wait. Conversely, the ReentrantReadWriteLock can be locked by a single writer thread at a ...