public static void enableCertFileReloading(Configuration config,
    AtomicReference<FileChangeWatcher> keystoreWatcher,
    AtomicReference<FileChangeWatcher> trustStoreWatcher, Runnable resetContext)
    throws IOException {
    String keyStoreLocation = config.get(TLS_CONFIG_KEYSTORE_LOCATION, "");
    keystoreWatcher.set(newFileChangeWatcher(config, keyStoreLocation, resetContext));
    String trustStoreLocation = config.get(TLS_CONFIG_TRUSTSTORE_LOCATION, "");
    // we are using the same callback for both. there's no reason to kick off two
    // threads if keystore/truststore are both at the same location
    if (!keyStoreLocation.equals(trustStoreLocation)) {
      trustStoreWatcher.set(newFileChangeWatcher(config, trustStoreLocation, resetContext));
    }
  }
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