/** * Disables automatic reloading of the trust store and key store files when they change on disk. * Stops background threads and closes WatchService instances. */ @Override public void close() { if (keyStoreFileWatcher != null) { keyStoreFileWatcher.stop(); keyStoreFileWatcher = null; } if (trustStoreFileWatcher != null) { trustStoreFileWatcher.stop(); trustStoreFileWatcher = null; } }
/** * Enables automatic reloading of the trust store and key store files when they change on disk. * * @throws IOException if creating the FileChangeWatcher objects fails. */ public void enableCertFileReloading() throws IOException { LOG.info("enabling cert file reloading"); ZKConfig config = zkConfig == null ? new ZKConfig() : zkConfig; FileChangeWatcher newKeyStoreFileWatcher = newFileChangeWatcher(config.getProperty(sslKeystoreLocationProperty)); if (newKeyStoreFileWatcher != null) { // stop old watcher if there is one if (keyStoreFileWatcher != null) { keyStoreFileWatcher.stop(); } keyStoreFileWatcher = newKeyStoreFileWatcher; keyStoreFileWatcher.start(); } FileChangeWatcher newTrustStoreFileWatcher = newFileChangeWatcher(config.getProperty(sslTruststoreLocationProperty)); if (newTrustStoreFileWatcher != null) { // stop old watcher if there is one if (trustStoreFileWatcher != null) { trustStoreFileWatcher.stop(); } trustStoreFileWatcher = newTrustStoreFileWatcher; trustStoreFileWatcher.start(); } }
} finally { if (watcher != null) { watcher.stop(); watcher.waitForState(FileChangeWatcher.State.STOPPED);
watcher.stop(); watcher.waitForState(FileChangeWatcher.State.STOPPED);
watcher.stop(); watcher.waitForState(FileChangeWatcher.State.STOPPED);
watcher.stop(); watcher.waitForState(FileChangeWatcher.State.STOPPED);
watcher.stop(); watcher.waitForState(FileChangeWatcher.State.STOPPED);