类 WatchFileCenter
- java.lang.Object
-
- com.alibaba.nacos.sys.file.WatchFileCenter
-
public class WatchFileCenter extends java.lang.ObjectUnified file change monitoring management center, which usesWatchServiceinternally. One file directory corresponds to oneWatchService. It can only monitor up to 32 file directories. When a file change occurs, aFileChangeEventwill be issued- 作者:
- liaochuntao
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 private static classWatchFileCenter.WatchDirJob
-
字段概要
字段 修饰符和类型 字段 说明 private static java.util.concurrent.atomic.AtomicBooleanCLOSEDprivate static java.nio.file.FileSystemFILE_SYSTEMprivate static org.slf4j.LoggerLOGGERprivate static java.util.Map<java.lang.String,WatchFileCenter.WatchDirJob>MANAGERprivate static intMAX_WATCH_FILE_JOBMaximum number of monitored file directories.private static intNOW_WATCH_JOB_CNTThe number of directories that are currently monitored.
-
构造器概要
构造器 构造器 说明 WatchFileCenter()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 private static voidcheckState()static booleanderegisterAllWatcher(java.lang.String path)Deregister allFileWatcherin this directory.static booleanderegisterWatcher(java.lang.String path, FileWatcher watcher)DeregisterFileWatcherin this directory.static booleanregisterWatcher(java.lang.String paths, FileWatcher watcher)RegisterFileWatcherin this directory.static voidshutdown()closeWatchFileCenter.
-
-
-
字段详细资料
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
MAX_WATCH_FILE_JOB
private static final int MAX_WATCH_FILE_JOB
Maximum number of monitored file directories.
-
MANAGER
private static final java.util.Map<java.lang.String,WatchFileCenter.WatchDirJob> MANAGER
-
FILE_SYSTEM
private static final java.nio.file.FileSystem FILE_SYSTEM
-
CLOSED
private static final java.util.concurrent.atomic.AtomicBoolean CLOSED
-
NOW_WATCH_JOB_CNT
private static int NOW_WATCH_JOB_CNT
The number of directories that are currently monitored.
-
-
方法详细资料
-
registerWatcher
public static boolean registerWatcher(java.lang.String paths, FileWatcher watcher) throws com.alibaba.nacos.api.exception.NacosExceptionRegisterFileWatcherin this directory.- 参数:
paths- directorywatcher-FileWatcher- 返回:
- register is success
- 抛出:
com.alibaba.nacos.api.exception.NacosException- NacosException
-
deregisterAllWatcher
public static boolean deregisterAllWatcher(java.lang.String path)
Deregister allFileWatcherin this directory.- 参数:
path- directory- 返回:
- deregister is success
-
shutdown
public static void shutdown()
closeWatchFileCenter.
-
deregisterWatcher
public static boolean deregisterWatcher(java.lang.String path, FileWatcher watcher)DeregisterFileWatcherin this directory.- 参数:
path- directorywatcher-FileWatcher- 返回:
- deregister is success
-
checkState
private static void checkState()
-
-