java.lang.Object
me.lucko.luckperms.common.storage.implementation.file.watcher.AbstractFileWatcher
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
FileWatcher

public abstract class AbstractFileWatcher extends Object implements AutoCloseable
Utility for "watching" for file changes using a WatchService.
  • Constructor Details

  • Method Details

    • register

      public void register(Path directory) throws IOException
      Register a watch key in the given directory.
      Parameters:
      directory - the directory
      Throws:
      IOException - if unable to register a key
    • registerRecursively

      public void registerRecursively(Path root) throws IOException
      Register a watch key recursively in the given directory.
      Parameters:
      root - the root directory
      Throws:
      IOException - if unable to register a key
    • processEvent

      protected abstract void processEvent(WatchEvent<Path> event, Path path)
      Process an observed watch event.
      Parameters:
      event - the event
      path - the resolved event context
    • runEventProcessingLoop

      public final void runEventProcessingLoop()
      Processes WatchEvents from the watch service until it is closed, or until the thread is interrupted.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable