/** * Customize the queue reader to process the watch events for the given directory, provided by the watch service * * @param watchService the watch service, requesting the watch events for the watched directory * @param toWatch the directory being watched by the watch service * @param watchSubDirectories a boolean flag that specifies if the child directories of the registered directory * will being watched by the watch service */ protected void customizeWatchQueueReader(AbstractWatchService watchService, Path toWatch, boolean watchSubDirectories) { try { if (watchSubDirectories) { // walk through all folders and follow symlinks registerWithSubDirectories(watchService, toWatch); } else { registerDirectoryInternal(watchService, watchService.getWatchEventKinds(toWatch), toWatch); } } catch (NoSuchFileException e) { logger.debug("Not watching folder '{}' as it does not exist.", toWatch); } catch (IOException e) { logger.warn("Cannot customize folder watcher for folder '{}'", toWatch, e); } }
/** * Customize the queue reader to process the watch events for the given directory, provided by the watch service * * @param watchService the watch service, requesting the watch events for the watched directory * @param toWatch the directory being watched by the watch service * @param watchSubDirectories a boolean flag that specifies if the child directories of the registered directory * will being watched by the watch service */ protected void customizeWatchQueueReader(AbstractWatchService watchService, Path toWatch, boolean watchSubDirectories) { try { if (watchSubDirectories) { // walk through all folders and follow symlinks registerWithSubDirectories(watchService, toWatch); } else { registerDirectoryInternal(watchService, watchService.getWatchEventKinds(toWatch), toWatch); } } catch (NoSuchFileException e) { logger.debug("Not watching folder '{}' as it does not exist.", toWatch); } catch (IOException e) { logger.warn("Cannot customize folder watcher for folder '{}'", toWatch, e); } }