private void waitUntilServerIsInitialized ( ) { int i = 0 ; for ( ; i < 60 ; i ++ ) { if ( server . hasInitialized ( ) || shutdown ) { return ; } try { Thread . sleep ( 1000 ) ; } catch ( InterruptedException e ) { logger . warn ( "Thread was interrupted" ) ; } } logger . error ( "Can't recover from the Journal - " + "the server hasn't initialized after " + i + " seconds." ) ; shutdown = true ; }
Wait for the server to initialize . If we wait too long give up and shut down the thread .