class SyncReceiverLogAnalyzer implements ISyncReceiverLogAnalyzer {

  private boolean recover(File senderFolder) throws IOException {
    // check the state
    if (!new File(senderFolder, SyncConstant.SYNC_LOG_NAME).exists()) {
      new File(senderFolder, SyncConstant.LOAD_LOG_NAME).delete();
      FileUtils.deleteDirectory(new File(senderFolder, SyncConstant.RECEIVER_DATA_FOLDER_NAME));
      return true;
    }
    if (FileLoaderManager.getInstance().containsFileLoader(senderFolder.getName())) {
      FileLoaderManager.getInstance().getFileLoader(senderFolder.getName()).endSync();
      try {
        Thread.sleep(FileLoader.WAIT_TIME << 1);
      } catch (InterruptedException e) {
        LOGGER.error("Thread is interrupted from waiting for ending sync in recovery.");
        Thread.currentThread().interrupt();
      }
    } else {
      scanLogger(FileLoader.createFileLoader(senderFolder),
          new File(senderFolder, SyncConstant.SYNC_LOG_NAME),
          new File(senderFolder, SyncConstant.LOAD_LOG_NAME));
    }
    return !FileLoaderManager.getInstance().containsFileLoader(senderFolder.getName());
  }

  private  SyncReceiverLogAnalyzer();

}