public void await ( ) { boolean intr = false ; final Object lock = this . lock ; try { synchronized ( lock ) { while ( ! readClosed ) { try { lock . wait ( ) ; } catch ( InterruptedException e ) { intr = true ; } } } } finally { if ( intr ) { Thread . currentThread ( ) . interrupt ( ) ; } } }
Wait for the read side to close . Used when the writer needs to know when the reader finishes consuming a message .