Class WatchServiceFileSystemWatcher

java.lang.Object
io.quarkus.deployment.dev.filesystem.watch.WatchServiceFileSystemWatcher
All Implemented Interfaces:
Runnable

public class WatchServiceFileSystemWatcher extends Object implements Runnable
File system watcher service based on JDK7 WatchService. Instantiating this class will create a new thread, that will run until close() is called. NOTE: this was copied from Xnio, it provides more functionality than we currently need.
  • Constructor Details

    • WatchServiceFileSystemWatcher

      public WatchServiceFileSystemWatcher(String name, boolean daemon)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • watchDirectoryRecursively

      public void watchDirectoryRecursively(Path directory, FileChangeCallback callback)
    • watchFiles

      public void watchFiles(Path directory, List<Path> monitoredFiles, FileChangeCallback callback)
      Parameters:
      directory - a directory that will be watched
      monitoredFiles - list of monitored files relative to directory. An empty list will monitor all files.
      callback - callback called when a file is changed
    • unwatchPath

      public void unwatchPath(Path directory, FileChangeCallback callback)
    • close

      public void close() throws IOException
      Throws:
      IOException