/// @param minReloadIntervalMS /// the minimum interval in milliseconds after which a full reload of the original datafile is done /// when refresh() is called /// @see #FileItemSimilarity(File) public FileItemSimilarity(File dataFile, long minReloadIntervalMS) { //Preconditions.checkArgument(dataFile != null, "dataFile is null"); //Preconditions.checkArgument(dataFile.exists() && !dataFile.isDirectory(), // "dataFile is missing or a directory: %s", dataFile); log.info("Creating FileItemSimilarity for file {}", dataFile); this.dataFile = dataFile.getAbsoluteFile(); this.lastModified = dataFile.lastModified(); this.minReloadIntervalMS = minReloadIntervalMS; this.reloadLock = new ReentrantLock(); reload(); }
public FileIDMigrator(File dataFile, long minReloadIntervalMS) { longToString = new FastByIDMap<String>(100); this.dataFile = Preconditions.checkNotNull(dataFile); if (!dataFile.exists() || dataFile.isDirectory()) { throw new FileNotFoundException(dataFile.toString()); } log.info("Creating FileReadonlyIDMigrator for file {}", dataFile); this.reloadLock = new ReentrantLock(); this.lastModified = dataFile.lastModified(); this.minReloadIntervalMS = minReloadIntervalMS; reload(); }