Lock readLock( ); Lock writeLock( );}
public class ReentrantReadWriteLock implements ReadWriteLock { public ReentrantReadWriteLock( ); public ReentrantReadWriteLock(boolean fair); public Lock writeLock( ); public Lock readLock( );}You create a reader-writer lock by instantiating an object using the ReentrantReadWriteLock class. Like the ReentrantLock class, an option allows the locks to be distributed in a fair fashion. By "fair," this class means that the lock is granted on very close to a first-come-first-serve basis. When the lock is released, the next set of readers/writer is granted the lock based on arrival time.