@Override
    public void registerWatcher() {
        try {
            Path dir = Paths.get(this.getClass().getClassLoader().getResource(configFile).toURI()).getParent();
            logger.info("start watch dir:{}",dir);
            WatchKey watchKey = dir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE,StandardWatchEventKinds.ENTRY_MODIFY,
                    StandardWatchEventKinds.ENTRY_DELETE);
        } catch (Exception e) {
            logger.error("registerWatcher error:{}",e);
            return;
        }
        Runnable checkConfigLoop = new Runnable() {
            @Override
            public void run() {
                while(true){
                    WatchKey key = null;
                    try {
                        key = watcher.take();
                    } catch (InterruptedException e) {
                        logger.error("checkConfigLoop InterruptedException:{}",e);
                    }
                    for (WatchEvent<?> event : key.pollEvents()) {
                        WatchEvent.Kind kind = event.kind();
                        if (kind == StandardWatchEventKinds.OVERFLOW) {
                            continue;
                        }
                        // 目录监视事件的上下文是文件名
                        WatchEvent<Path> evt = (WatchEvent<Path>)event;
                        Path name = evt.context();
                        if(name.toString().equals(configFile)){
                            logger.info("local config file:{} change ,load new config...",configFile);
                            try {
                                loadConfig(configFile);
                            }catch(Throwable e){
                                logger.error("checkConfigLoop loadConfig error:{}",e);
                            }
                        }else{
                            logger.debug("ignore event:it was not a config file changing as name:{}",name);
                        }
                    }
                    boolean valid = key.reset();
                    if (!valid)
                    {
                        break;	// Exit if directory is deleted
                    }
                }
            }
        };
        executorService.submit(checkConfigLoop);
    }