@Override
	public void run() {
		while (true) {
			// wait for key to be signaled
			WatchKey key;
			try {
				key = watcher.take();
			} catch (InterruptedException x) {
				return;
			}

			for (WatchEvent<?> event : key.pollEvents()) {
				WatchEvent.Kind<?> kind = event.kind();

				// This key is registered only for ENTRY_MODIFY events,
				if (kind != StandardWatchEventKinds.ENTRY_MODIFY) {
					continue;
				}

				// The filename is the context of the event.
				@SuppressWarnings("unchecked")
				WatchEvent<Path> ev = (WatchEvent<Path>) event;
				Path filename = ev.context();

				LOGGER.debug("File {} changed.", filename);

				if (isSameFile(filename, watchedFile)) {
					configGroup.initConfigs();
				}

			}
			
			boolean status = key.reset();
			if(!status) {
				break;
			}
		}
	}
Watcher for file changes

@author <a href="mailto:wangyuxuan@dangdang.com">Yuxuan Wang</a>
config-toolkit/src/main/java/com/dangdang/config/service/file/FileChangeEventListener.java