Class DefaultRecursiveWatcher

  • public class DefaultRecursiveWatcher
    extends RecursiveWatcher
    The default recursive file watcher monitors a folder (and its sub-folders) by registering a watch on each of the sub-folders. This class is used on Linux/Unix-based operating systems and uses the Java 7 WatchService.

    The class walks through the file tree and registers to a watch to every sub-folder. For new folders, a new watch is registered, and stale watches are removed.

    When a file event occurs, a timer is started to wait for the file operations to settle. It is reset whenever a new event occurs. When the timer times out, an event is thrown through the RecursiveWatcher.WatchListener.