Class WatchManager

    • Method Detail

      • getId

        public UUID getId()
      • hasEventListeners

        public boolean hasEventListeners()
      • reset

        public void reset()
        Resets all file monitors to their current last modified time. If this manager does not watch any file, nothing happens.

        This allows you to start, stop, reset and start again a manager, without triggering file modified events if the a watched file has changed during the period of time when the manager was stopped.

        Since:
        2.11.0
      • reset

        public void reset​(File file)
        Resets the file monitor for the given file being watched to its current last modified time. If this manager does not watch the given file, nothing happens.

        This allows you to start, stop, reset and start again a manager, without triggering file modified events if the given watched file has changed during the period of time when the manager was stopped.

        Parameters:
        file - the file for the monitor to reset.
        Since:
        2.11.0
      • reset

        public void reset​(Source source)
        Resets the configuration monitor for the given file being watched to its current last modified time. If this manager does not watch the given configuration, nothing happens.

        This allows you to start, stop, reset and start again a manager, without triggering file modified events if the given watched configuration has changed during the period of time when the manager was stopped.

        Parameters:
        source - the Source for the monitor to reset.
        Since:
        2.12.0
      • setIntervalSeconds

        public void setIntervalSeconds​(int intervalSeconds)
      • getIntervalSeconds

        public int getIntervalSeconds()
        Gets how often this manager checks for file modifications.
        Returns:
        how often, in seconds, this manager checks for file modifications.
      • stop

        public boolean stop​(long timeout,
                            TimeUnit timeUnit)
        Description copied from interface: LifeCycle2
        Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
        Specified by:
        stop in interface LifeCycle2
        Overrides:
        stop in class AbstractLifeCycle
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the receiver was stopped cleanly and normally, false otherwise.
      • unwatchFile

        public void unwatchFile​(File file)
        Unwatches the given file.
        Parameters:
        file - the file to stop watching.
        Since:
        2.11.0
      • unwatch

        public void unwatch​(Source source)
        Unwatches the given file.
        Parameters:
        source - the Source to stop watching. the file to stop watching.
        Since:
        2.12.0
      • checkFiles

        public void checkFiles()
      • watchFile

        public void watchFile​(File file,
                              FileWatcher fileWatcher)
        Watches the given file.
        Parameters:
        file - the file to watch.
        fileWatcher - the watcher to notify of file changes.
      • watch

        public void watch​(Source source,
                          Watcher watcher)
        Watches the given file.
        Parameters:
        source - the source to watch.
        watcher - the watcher to notify of file changes.
      • getWatchers

        public Map<File,​FileWatcher> getWatchers()
        Deprecated.
        use getConfigurationWatchers.
        Returns a Map of the file watchers.
        Returns:
        A Map of the file watchers.
      • getConfigurationWatchers

        public Map<Source,​Watcher> getConfigurationWatchers()
        Return the ConfigurationWaatchers.
        Returns:
        the ConfigurationWatchers.
        Since:
        2.11.2