use of org.neo4j.kernel.impl.util.watcher.DefaultFileDeletionEventListener in project neo4j by neo4j.
the class EditionModule method createFileSystemWatcherService.
protected FileSystemWatcherService createFileSystemWatcherService(FileSystemAbstraction fileSystem, File storeDir, LogService logging, JobScheduler jobScheduler, Predicate<String> fileNameFilter) {
try {
RestartableFileSystemWatcher watcher = new RestartableFileSystemWatcher(fileSystem.fileWatcher());
watcher.addFileWatchEventListener(new DefaultFileDeletionEventListener(logging, fileNameFilter));
watcher.watch(storeDir);
// register to watch store dir parent folder to see when store dir removed
watcher.watch(storeDir.getParentFile());
return new DefaultFileSystemWatcherService(jobScheduler, watcher);
} catch (Exception e) {
Log log = logging.getInternalLog(getClass());
log.warn("Can not create file watcher for current file system. File monitoring capabilities for store " + "files will be disabled.", e);
return FileSystemWatcherService.EMPTY_WATCHER;
}
}
Aggregations