private static FileChangeWatcher newFileChangeWatcher(Configuration config, String fileLocation,
    Runnable resetContext) throws IOException {
    if (fileLocation == null || fileLocation.isEmpty() || resetContext == null) {
      return null;
    }
    final Path filePath = Paths.get(fileLocation).toAbsolutePath();
    FileChangeWatcher fileChangeWatcher =
      new FileChangeWatcher(filePath, Objects.toString(filePath.getFileName()),
        Duration
          .ofMillis(config.getLong(HBASE_TLS_FILEPOLL_INTERVAL_MILLIS, DEFAULT_FILE_POLL_INTERVAL)),
        watchEventFilePath -> handleWatchEvent(watchEventFilePath, resetContext));
    fileChangeWatcher.start();
    return fileChangeWatcher;
  }
Enable certificate file reloading by creating FileWatchers for keystore and truststore.
AtomicReferences will be set with the new instances. resetContext - if not null - will be
called when the file has been modified.
@param keystoreWatcher   Reference to keystoreFileWatcher.
@param trustStoreWatcher Reference to truststoreFileWatcher.
@param resetContext      Callback for file changes.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/tls/X509Util.java