@Test public void testNoFilesToRecover() throws IOException { manager.recoverFilters(factory, true); verify(filterManager, never()).addFilters(anyCollection()); }
synchronized List<FilterRecord<? extends F>> recoverFilters(BloomFilterFactory<? extends F, ?> factory, boolean allowRecoverFromCorruptedFile) throws IOException { final List<FilterRecord<? extends F>> records = new ArrayList<>(); if (persistentFilePath().toFile().exists()) { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, persistentFilePath())); } if (temporaryPersistentFilePath().toFile().exists()) { try { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, temporaryPersistentFilePath())); } catch (IOException | PersistentStorageException ex) { logger.warn("Failed to recover from the file: \"{}\" and got error msg: \"{}\". We just ignore it and carry on.", temporaryPersistentFilePath(), ex.getMessage()); } } return records; }
PersistentManager implements Closeable { synchronized List<FilterRecord<? extends F>> recoverFilters(BloomFilterFactory<? extends F, ?> factory, boolean allowRecoverFromCorruptedFile) throws IOException { final List<FilterRecord<? extends F>> records = new ArrayList<>(); if (persistentFilePath().toFile().exists()) { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, persistentFilePath())); } if (temporaryPersistentFilePath().toFile().exists()) { try { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, temporaryPersistentFilePath())); } catch (IOException | PersistentStorageException ex) { logger.warn("Failed to recover from the file: \"{}\" and got error msg: \"{}\". We just ignore it and carry on.", temporaryPersistentFilePath(), ex.getMessage()); } } return records; } }
PersistentManager implements Closeable { synchronized List<FilterRecord<? extends F>> recoverFilters(BloomFilterFactory<? extends F, ?> factory, boolean allowRecoverFromCorruptedFile) throws IOException { final List<FilterRecord<? extends F>> records = new ArrayList<>(); if (persistentFilePath().toFile().exists()) { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, persistentFilePath())); } if (temporaryPersistentFilePath().toFile().exists()) { try { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, temporaryPersistentFilePath())); } catch (IOException | PersistentStorageException ex) { logger.warn("Failed to recover from the file: \"{}\" and got error msg: \"{}\". We just ignore it and carry on.", temporaryPersistentFilePath(), ex.getMessage()); } } return records; } PersistentManager(Path persistentPath); }
PersistentManager implements Closeable { synchronized List<FilterRecord<? extends F>> recoverFilters(BloomFilterFactory<? extends F, ?> factory, boolean allowRecoverFromCorruptedFile) throws IOException { final List<FilterRecord<? extends F>> records = new ArrayList<>(); if (persistentFilePath().toFile().exists()) { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, persistentFilePath())); } if (temporaryPersistentFilePath().toFile().exists()) { try { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, temporaryPersistentFilePath())); } catch (IOException | PersistentStorageException ex) { logger.warn("Failed to recover from the file: \"{}\" and got error msg: \"{}\". We just ignore it and carry on.", temporaryPersistentFilePath(), ex.getMessage()); } } return records; } PersistentManager(Path persistentPath); @Override synchronized void close(); }
PersistentManager implements Closeable { synchronized List<FilterRecord<? extends F>> recoverFilters(BloomFilterFactory<? extends F, ?> factory, boolean allowRecoverFromCorruptedFile) throws IOException { final List<FilterRecord<? extends F>> records = new ArrayList<>(); if (persistentFilePath().toFile().exists()) { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, persistentFilePath())); } if (temporaryPersistentFilePath().toFile().exists()) { try { records.addAll(recoverFiltersFromFile(factory, allowRecoverFromCorruptedFile, temporaryPersistentFilePath())); } catch (IOException | PersistentStorageException ex) { logger.warn("Failed to recover from the file: \"{}\" and got error msg: \"{}\". We just ignore it and carry on.", temporaryPersistentFilePath(), ex.getMessage()); } } return records; } PersistentManager(Path persistentPath); @Override synchronized void close();  }