public synchronized boolean waitForValidValues ( ) throws IOException , FileNotFoundException { for ( int tries = 0 ; tries < 50 ; tries ++ ) { lock ( ) ; getValues ( ) ; unlock ( ) ; if ( containsPortInfo ) { Log . debug ( "Found valid values in port file after waiting " + ( tries * 100 ) + "ms" ) ; return true ; } try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } } Log . debug ( "Gave up waiting for valid values in port file" ) ; return false ; }
Wait for the port file to contain values that look valid . Return true if a - ok false if the valid values did not materialize within 5 seconds .