question: protected void waitForMessagesToBeDelivered ( ) { long maxWaitTime = 60000 ; long waitTime = maxWaitTime ; long start = ( maxWaitTime <= 0 ) ? 0 : System . currentTimeMillis ( ) ; synchronized ( lock ) { while ( messages . size ( ) < data . length && waitTime >= 0 ) { try { lock . wait ( 200 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } waitTime = maxWaitTime - ( System . currentTimeMillis ( ) - start ) ; } } }
target:  Waits for the messages to be delivered or when the wait time has been reached.