private void register(FileWatchRegisterKey watchRegisterKey, Runnable callback) {
            final Path dirPath = watchRegisterKey.filePath().getParent();
            checkArgument(dirPath != null, "no parent directory for input path: %s",
                          watchRegisterKey.filePath());

            final WatchKey watchKey;
            try {
                watchKey = dirPath.register(watchService, ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE, OVERFLOW);
            } catch (IOException e) {
                throw new IllegalArgumentException("failed to watch a file " + watchRegisterKey.filePath(), e);
            }
            currWatchEventMap.put(watchRegisterKey, new FileWatchEvent(watchKey, callback, dirPath));
            restartableThread.start();
        }
Starts to watch changes for the path corresponding to the {@link FileWatchRegisterKey}.
When changes are detected, the {@code callback} is invoked. If a {@link WatchService}
isn't running yet, this method starts a thread to start watching the {@link FileSystem}.
@param watchRegisterKey the key that contains the path to be watched
@param callback the function invoked on file change

@throws IllegalArgumentException if failed to locate file or failed to start watching
core/src/main/java/com/linecorp/armeria/client/endpoint/FileWatcherRegistry.java