public void waitUntilFinish(){
  while (!finished) {
synchronized (waitingLock) {
      if (finished) {
        return;
      }
      try {
        waitingLock.wait();
      }
 catch (      InterruptedException e) {
        logger.error("Error occurred",e);
      }
    }
  }
}

public void waitUntilFinish ( ) { while ( ! finished ) { synchronized ( waitingLock ) { if ( finished ) { return ; } try { waitingLock . wait ( ) ; } catch ( InterruptedException e ) { logger . error ( "Error occurred" , e ) ; } } } }
wait until this crawling session finishes .
