question: public void writeRequest ( ) { Object lock = new Object ( ) ; synchronized ( lock ) { synchronized ( this ) { boolean goAheadWithWrite = writerLocks . size ( ) == 0 && currentReaders == 0 && currentWriters == 0 ; if ( goAheadWithWrite ) { ++ currentWriters ; return ; } writerLocks . addLast ( lock ) ; } try { lock . wait ( ) ; } catch ( InterruptedException e ) { } } }
target:  Request the write lock. Block until a write operation can be performed safely. Write requests are guaranteed to be executed in the order received. Pending read requests take precedence over all write requests. This call must be followed by a call to writeDone() when the write operation completes.