class PersistentManager implements Closeable {

    synchronized void freezeAllFilters(Iterable<FilterRecord<F>> records) throws IOException {
        final Path tempPath = temporaryPersistentFilePath();
        int counter = 0;
        try (FileChannel channel = FileChannel.open(tempPath, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.READ)) {
            for (FilterRecord<F> record : records) {
                record.writeFullyTo(channel);
                counter++;
            }

            channel.force(true);
        }

        FilterServiceFileUtils.atomicMoveWithFallback(tempPath, persistentFilePath());
        logger.debug("Persistent " + counter + " filters.");
    }

      PersistentManager(Path persistentPath);

}