public void watch( CertificateStore store )
    {
        if ( store == null )
        {
            throw new IllegalArgumentException( "Argument 'store' cannot be null." );
        }

        if ( storeWatcher == null )
        {
            return;
        }

        final Path dir = store.getConfiguration().getFile().toPath().normalize().getParent();

        synchronized ( watchedStores )
        {
            watchedStores.put( store, dir );

            // Watch the directory that contains the keystore, if we're not already watching it.
            if ( !watchedPaths.containsKey( dir ) )
            {
                try
                {
                    // Ignoring deletion events, as those changes should be applied via property value changes.
                    final WatchKey watchKey = dir.register( storeWatcher, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE );
                    watchedPaths.put( dir, watchKey );
                }
                catch ( Throwable t )
                {
                    Log.warn( "Unable to add a watcher for a path that contains files that provides the backend storage for certificate stores. Changes to those files are unlikely to be picked up automatically. Path: {}", dir, t );
                    watchedStores.remove( store );
                }
            }
        }
    }
Start watching the file that backs a Certificate Store for changes, reloading the Certificate Store when
appropriate.

This method does nothing when the file watching functionality is not supported by the file system.

@param store The certificate store (cannot be null).
xmppserver/src/main/java/org/jivesoftware/openfire/keystore/CertificateStoreWatcher.java