Class CollectionPropertiesZkStateReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class CollectionPropertiesZkStateReader
    extends Object
    implements Closeable
    Fetches and manages collection properties from a ZooKeeper ensemble
    • Constructor Detail

      • CollectionPropertiesZkStateReader

        public CollectionPropertiesZkStateReader​(ZkStateReader zkStateReader)
    • Method Detail

      • getCollectionProperties

        public Map<String,​String> getCollectionProperties​(String collection,
                                                                long cacheForMillis)
        Get and cache collection properties for a given collection. If the collection is watched, or still cached simply return it from the cache, otherwise fetch it directly from zookeeper and retain the value for at least cacheForMillis milliseconds. Cached properties are watched in zookeeper and updated automatically. This version of getCollectionProperties should be used when properties need to be consulted frequently in the absence of an active CollectionPropsWatcher.
        Parameters:
        collection - The collection for which properties are desired
        cacheForMillis - The minimum number of milliseconds to maintain a cache for the specified collection's properties. Setting a CollectionPropsWatcher will override this value and retain the cache for the life of the watcher. A lack of changes in zookeeper may allow the caching to remain for a greater duration up to the cycle time of CacheCleaner. Passing zero for this value will explicitly remove the cached copy if and only if it is due to expire and no watch exists. Any positive value will extend the expiration time if required.
        Returns:
        a map representing the key/value properties for the collection.
      • refreshCollectionProperties

        protected void refreshCollectionProperties()
      • getCollectionPropsPath

        public static String getCollectionPropsPath​(String collection)