Package jadex.commons

Class FileWatcher


  • public class FileWatcher
    extends java.lang.Object
    Watcher for files, written to be backwards compatible. TODO: Implement polling.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean running
      Flag if running.
      protected java.lang.Thread thread
      The watch thread.
      protected java.io.File watchedfile
      The watched file.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileWatcher​(java.lang.String filepath, java.lang.Runnable run, boolean forcepoll)
      Creates the watcher.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void finalize()
      Override
      protected void pollingMode​(java.lang.Runnable run)
      Use polling mode.
      void stop()
      Stops the monitoring.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • running

        protected boolean running
        Flag if running.
      • thread

        protected java.lang.Thread thread
        The watch thread.
      • watchedfile

        protected java.io.File watchedfile
        The watched file.
    • Constructor Detail

      • FileWatcher

        public FileWatcher​(java.lang.String filepath,
                           java.lang.Runnable run,
                           boolean forcepoll)
        Creates the watcher.
        Parameters:
        filepath - File to watch.
        run - Callback on changes.
    • Method Detail

      • stop

        public void stop()
        Stops the monitoring.
      • pollingMode

        protected void pollingMode​(java.lang.Runnable run)
        Use polling mode.
        Parameters:
        run - The user runnable.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Override
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable