Class FileWatchdog

  • All Implemented Interfaces:
    Runnable

    public abstract class FileWatchdog
    extends Thread
    Checks every now and then that a certain file has not changed. If it has, then call the doOnChange() method.
    Since:
    version 0.9.1
    • Field Detail

      • DEFAULT_DELAY

        public static final long DEFAULT_DELAY
        The default delay between every file modification check, set to 60 seconds.
        See Also:
        Constant Field Values
      • filename

        protected String filename
        The name of the file to observe for changes.
      • delay

        protected long delay
        The delay to observe between every check. By default set DEFAULT_DELAY.
    • Constructor Detail

      • FileWatchdog

        protected FileWatchdog​(String fileName)
    • Method Detail

      • checkAndConfigure

        protected void checkAndConfigure()
      • doOnChange

        protected abstract void doOnChange()
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • setDelay

        public void setDelay​(long delayMillis)
        Sets the delay in milliseconds to observe between each check of the file changes.
        Parameters:
        delayMillis - the delay in milliseconds