Package com.alibaba.nacos.sys.file
Class WatchFileCenter
java.lang.Object
com.alibaba.nacos.sys.file.WatchFileCenter
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanderegisterAllWatcher(String path) Deregister allFileWatcherin this directory.static booleanderegisterWatcher(String path, FileWatcher watcher) DeregisterFileWatcherin this directory.static booleanregisterWatcher(String paths, FileWatcher watcher) RegisterFileWatcherin this directory.static voidshutdown()closeWatchFileCenter.
-
Constructor Details
-
WatchFileCenter
public WatchFileCenter()
-
-
Method Details
-
registerWatcher
public static boolean registerWatcher(String paths, FileWatcher watcher) throws com.alibaba.nacos.api.exception.NacosException RegisterFileWatcherin this directory.- Parameters:
paths- directorywatcher-FileWatcher- Returns:
- register is success
- Throws:
com.alibaba.nacos.api.exception.NacosException- NacosException
-
deregisterAllWatcher
Deregister allFileWatcherin this directory.- Parameters:
path- directory- Returns:
- deregister is success
-
shutdown
public static void shutdown()closeWatchFileCenter. -
deregisterWatcher
DeregisterFileWatcherin this directory.- Parameters:
path- directorywatcher-FileWatcher- Returns:
- deregister is success
-