void drain ( ) { lock . lock ( ) ; try { LOG . finest ( "Waiting while draining..." ) ; while ( isWorking ( ) && ( emptyRequestFuture == null || emptyRequestFuture . isDone ( ) ) ) { try { drained . await ( ) ; } catch ( InterruptedException intx ) { LOG . log ( Level . FINEST , INTERRUPTED , intx ) ; } } LOG . finest ( "Drained" ) ; } finally { lock . unlock ( ) ; } }
Wait until no more messages are waiting to be processed .