Package org.apache.solr.common.cloud
Class CollectionPropertiesZkStateReader
- java.lang.Object
- 
- org.apache.solr.common.cloud.CollectionPropertiesZkStateReader
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable
 
 public class CollectionPropertiesZkStateReader extends Object implements Closeable Fetches and manages collection properties from a ZooKeeper ensemble
- 
- 
Constructor SummaryConstructors Constructor Description CollectionPropertiesZkStateReader(ZkStateReader zkStateReader)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Map<String,String>getCollectionProperties(String collection, long cacheForMillis)Get and cache collection properties for a given collection.static StringgetCollectionPropsPath(String collection)protected voidrefreshCollectionProperties()voidregisterCollectionPropsWatcher(String collection, CollectionPropsWatcher propsWatcher)voidremoveCollectionPropsWatcher(String collection, CollectionPropsWatcher watcher)
 
- 
- 
- 
Constructor Detail- 
CollectionPropertiesZkStateReaderpublic CollectionPropertiesZkStateReader(ZkStateReader zkStateReader) 
 
- 
 - 
Method Detail- 
getCollectionPropertiespublic 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 ofgetCollectionPropertiesshould be used when properties need to be consulted frequently in the absence of an activeCollectionPropsWatcher.- 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- CollectionPropsWatcherwill 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.
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 - 
registerCollectionPropsWatcherpublic void registerCollectionPropsWatcher(String collection, CollectionPropsWatcher propsWatcher) 
 - 
refreshCollectionPropertiesprotected void refreshCollectionProperties() 
 - 
removeCollectionPropsWatcherpublic void removeCollectionPropsWatcher(String collection, CollectionPropsWatcher watcher) 
 
- 
 
-