Class FileSystemWatcher.Builder

    • Method Detail

      • config

        public FileSystemWatcher.Builder config​(Config metaConfig)
        Update this builder from meta configuration.

        Currently these options are supported:

        • initial-delay-millis - delay between the time this watcher is started and the time the first check is triggered
        • delay-millis - how often do we check the watcher service for changes
        As the watcher is implemented as non-blocking, a single watcher can be used to watch multiple directories using the same thread.
        Parameters:
        metaConfig - configuration of file system watcher
        Returns:
        updated builder instance
      • executor

        public FileSystemWatcher.Builder executor​(ScheduledExecutorService executor)
        Executor to use for this watcher. The task is scheduled for regular execution and is only blocking a thread for the time needed to process changed files.
        Parameters:
        executor - executor service to use
        Returns:
        updated builder instance
      • schedule

        public FileSystemWatcher.Builder schedule​(long initialDelay,
                                                  long delay,
                                                  TimeUnit timeUnit)
        Configure schedule of the file watcher.
        Parameters:
        initialDelay - initial delay before regular scheduling starts
        delay - delay between schedules
        timeUnit - time unit of the delays
        Returns:
        updated builer instance
      • addWatchServiceModifier

        public FileSystemWatcher.Builder addWatchServiceModifier​(WatchEvent.Modifier modifier)
        Add a modifier of the watch service. Currently only implementation specific modifier are available, such as com.sun.nio.file.SensitivityWatchEventModifier.
        Parameters:
        modifier - modifier to use
        Returns:
        updated builder instance
      • watchServiceModifiers

        public FileSystemWatcher.Builder watchServiceModifiers​(List<WatchEvent.Modifier> modifiers)
        Set modifiers to use for the watch service. Currently only implementation specific modifier are available, such as com.sun.nio.file.SensitivityWatchEventModifier.
        Parameters:
        modifiers - modifiers to use (replacing current configuration)
        Returns:
        updated builder instance