Class WatchFileCenter

java.lang.Object
com.alibaba.nacos.sys.file.WatchFileCenter

public class WatchFileCenter extends Object
Unified file change monitoring management center, which uses WatchService internally. One file directory corresponds to one WatchService. It can only monitor up to 32 file directories. When a file change occurs, a FileChangeEvent will be issued
Author:
liaochuntao
  • Constructor Details

    • WatchFileCenter

      public WatchFileCenter()
  • Method Details

    • registerWatcher

      public static boolean registerWatcher(String paths, FileWatcher watcher) throws com.alibaba.nacos.api.exception.NacosException
      Register FileWatcher in this directory.
      Parameters:
      paths - directory
      watcher - FileWatcher
      Returns:
      register is success
      Throws:
      com.alibaba.nacos.api.exception.NacosException - NacosException
    • deregisterAllWatcher

      public static boolean deregisterAllWatcher(String path)
      Deregister all FileWatcher in this directory.
      Parameters:
      path - directory
      Returns:
      deregister is success
    • shutdown

      public static void shutdown()
    • deregisterWatcher

      public static boolean deregisterWatcher(String path, FileWatcher watcher)
      Deregister FileWatcher in this directory.
      Parameters:
      path - directory
      watcher - FileWatcher
      Returns:
      deregister is success