private void waitForEventOrTimeout ( ) throws InterruptedException { long remainingWait = timeout - timeWaited ; long millisToWait = remainingWait / 1000000 ; int nanosToWait = ( int ) ( remainingWait % 1000000 ) ; wait ( millisToWait , nanosToWait ) ; }
Wait for a notification or a timeout - may wake spuriously .