private static void wait ( Object lock , int timeout ) { try { lock . wait ( timeout ) ; } catch ( InterruptedException unused ) { Thread . currentThread ( ) . interrupt ( ) ; } }
Wait notification on synchronized object for specified period of time . If timeout is zero this method blocks till notification arrive .