Class ZkStateReader
- java.lang.Object
- 
- org.apache.solr.common.cloud.ZkStateReader
 
- 
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- org.apache.solr.common.SolrCloseable
 
 public class ZkStateReader extends Object implements org.apache.solr.common.SolrCloseable 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classZkStateReader.AliasesManagerA class to manage the aliases instance, including watching for changes.protected static classZkStateReader.CollectionWatch<T>static classZkStateReader.ConfigData
 - 
Field Summary
 - 
Constructor SummaryConstructors Constructor Description ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout)ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout, boolean canUseZkACLs)ZkStateReader(SolrZkClient zkClient)ZkStateReader(SolrZkClient zkClient, Runnable securityNodeListener)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()IntegercompareStateVersions(String coll, int version)voidcreateClusterStateWatchersAndUpdate()voidforceUpdateCollection(String collection)Forcibly refresh a collection's internal state from ZK.voidforciblyRefreshAllClusterStateSlow()Forcibly refresh cluster state from ZK.static ZkStateReaderfrom(org.apache.solr.client.solrj.impl.CloudSolrClient solrClient)Gets the ZkStateReader inside a ZK based SolrClient.org.apache.solr.common.cloud.AliasesgetAliases()Get an immutable copy of the present state of the aliases.ZkStateReader.AliasesManagergetAliasesManager()StringgetBaseUrlForNodeName(String nodeName)Returns the baseURL corresponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.StringgetBaseUrlV2ForNodeName(String nodeName)Returns the V2 baseURL corresponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.Map<String,Object>getClusterProperties()Get all cluster properties for this cluster<T> TgetClusterProperty(String key, T defaultValue)Get a cluster property<T> TgetClusterProperty(List<String> keyPath, T defaultValue)Same as the above but allows a full json path as a list of partsorg.apache.solr.common.cloud.ClusterStategetClusterState()org.apache.solr.common.cloud.DocCollectiongetCollection(String collection)org.apache.solr.common.cloud.DocCollectiongetCollectionLive(String coll)static StringgetCollectionPath(String coll)Deprecated.static StringgetCollectionPathRoot(String coll)Deprecated.Map<String,String>getCollectionProperties(String collection)Get properties for a specific collectionMap<String,String>getCollectionProperties(String collection, long cacheForMillis)Get and cache collection properties for a given collectionSet<String>getCurrentCollections()org.apache.solr.common.cloud.ReplicagetLeader(String collection, String shard)org.apache.solr.common.cloud.ReplicagetLeader(Set<String> liveNodes, org.apache.solr.common.cloud.DocCollection docCollection, String shard)org.apache.solr.common.cloud.ReplicagetLeaderRetry(String collection, String shard)Get shard leader properties, with retry if none exist.org.apache.solr.common.cloud.ReplicagetLeaderRetry(String collection, String shard, int timeout)Get shard leader properties, with retry if none exist.StringgetLeaderUrl(String collection, String shard, int timeout)List<org.apache.solr.common.cloud.ZkCoreNodeProps>getReplicaProps(String collection, String shardId, String thisCoreNodeName)List<org.apache.solr.common.cloud.ZkCoreNodeProps>getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter)List<org.apache.solr.common.cloud.ZkCoreNodeProps>getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter, org.apache.solr.common.cloud.Replica.State mustNotMatchStateFilter)List<org.apache.solr.common.cloud.ZkCoreNodeProps>getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter, org.apache.solr.common.cloud.Replica.State mustNotMatchStateFilter, EnumSet<org.apache.solr.common.cloud.Replica.Type> acceptReplicaType)ZkStateReader.ConfigDatagetSecurityProps(boolean getFresh)Returns the content of /security.json from ZooKeeper as a Map If the files doesn't exist, it returns null.static StringgetShardLeadersElectPath(String collection, String shardId)Get path where shard leader elections ephemeral nodes are.static StringgetShardLeadersPath(String collection, String shardId)Get path where shard leader properties live in zookeeper.ObjectgetUpdateLock()SolrZkClientgetZkClient()SolrZkClientgetZKClient()booleanisClosed()booleanisNodeLive(String node)voidregisterCloudCollectionsListener(CloudCollectionsListener cloudCollectionsListener)Register a CloudCollectionsListener to be called when the set of collections within a cloud changes.voidregisterClusterPropertiesListener(ClusterPropertiesListener listener)voidregisterCollectionPropsWatcher(String collection, CollectionPropsWatcher propsWatcher)voidregisterCollectionStateWatcher(String collection, CollectionStateWatcher stateWatcher)Register a CollectionStateWatcher to be called when the state of a collection changes or the set of live nodes changes.voidregisterCore(String collection)Notify this reader that a local Core is a member of a collection, and so that collection state should be watched.voidregisterDocCollectionWatcher(String collection, DocCollectionWatcher docCollectionWatcher)Register a DocCollectionWatcher to be called when the cluster state for a collection changes.voidregisterLiveNodesListener(LiveNodesListener listener)voidremoveCloudCollectionsListener(CloudCollectionsListener cloudCollectionsListener)Remove a registered CloudCollectionsListener.voidremoveClusterPropertiesListener(ClusterPropertiesListener listener)voidremoveCollectionPropsWatcher(String collection, CollectionPropsWatcher watcher)voidremoveCollectionStateWatcher(String collection, CollectionStateWatcher watcher)Remove a watcher from a collection's watch list.voidremoveDocCollectionWatcher(String collection, DocCollectionWatcher watcher)Remove a watcher from a collection's watch list.voidremoveLiveNodesListener(LiveNodesListener listener)voidunregisterCore(String collection)Notify this reader that a local core that is a member of a collection has been closed.voidupdateLiveNodes()Refresh the set of live nodes.voidwaitForLiveNodes(long wait, TimeUnit unit, LiveNodesPredicate predicate)Block until a LiveNodesStatePredicate returns true, or the wait times outorg.apache.solr.common.cloud.DocCollectionwaitForState(String collection, long wait, TimeUnit unit, Predicate<org.apache.solr.common.cloud.DocCollection> predicate)Block until a Predicate returns true, or the wait times outvoidwaitForState(String collection, long wait, TimeUnit unit, org.apache.solr.common.cloud.CollectionStatePredicate predicate)Block until a CollectionStatePredicate returns true, or the wait times out
 
- 
- 
- 
Field Detail- 
STATE_UPDATE_DELAYpublic static final int STATE_UPDATE_DELAY 
 - 
BASE_URL_PROPpublic static final String BASE_URL_PROP - See Also:
- Constant Field Values
 
 - 
NODE_NAME_PROPpublic static final String NODE_NAME_PROP - See Also:
- Constant Field Values
 
 - 
CORE_NODE_NAME_PROPpublic static final String CORE_NODE_NAME_PROP - See Also:
- Constant Field Values
 
 - 
ROLES_PROPpublic static final String ROLES_PROP - See Also:
- Constant Field Values
 
 - 
STATE_PROPpublic static final String STATE_PROP - See Also:
- Constant Field Values
 
 - 
FORCE_SET_STATE_PROPpublic static final String FORCE_SET_STATE_PROP - See Also:
- Constant Field Values
 
 - 
CORE_NAME_PROPpublic static final String CORE_NAME_PROP SolrCore name.- See Also:
- Constant Field Values
 
 - 
COLLECTION_PROPpublic static final String COLLECTION_PROP - See Also:
- Constant Field Values
 
 - 
ELECTION_NODE_PROPpublic static final String ELECTION_NODE_PROP - See Also:
- Constant Field Values
 
 - 
SHARD_ID_PROPpublic static final String SHARD_ID_PROP - See Also:
- Constant Field Values
 
 - 
REPLICA_PROPpublic static final String REPLICA_PROP - See Also:
- Constant Field Values
 
 - 
SHARD_RANGE_PROPpublic static final String SHARD_RANGE_PROP - See Also:
- Constant Field Values
 
 - 
SHARD_STATE_PROPpublic static final String SHARD_STATE_PROP - See Also:
- Constant Field Values
 
 - 
SHARD_PARENT_PROPpublic static final String SHARD_PARENT_PROP - See Also:
- Constant Field Values
 
 - 
NUM_SHARDS_PROPpublic static final String NUM_SHARDS_PROP - See Also:
- Constant Field Values
 
 - 
LEADER_PROPpublic static final String LEADER_PROP - See Also:
- Constant Field Values
 
 - 
SHARED_STORAGE_PROPpublic static final String SHARED_STORAGE_PROP - See Also:
- Constant Field Values
 
 - 
PROPERTY_PROPpublic static final String PROPERTY_PROP - See Also:
- Constant Field Values
 
 - 
PROPERTY_PROP_PREFIXpublic static final String PROPERTY_PROP_PREFIX - See Also:
- Constant Field Values
 
 - 
PROPERTY_VALUE_PROPpublic static final String PROPERTY_VALUE_PROP - See Also:
- Constant Field Values
 
 - 
MAX_AT_ONCE_PROPpublic static final String MAX_AT_ONCE_PROP - See Also:
- Constant Field Values
 
 - 
MAX_WAIT_SECONDS_PROPpublic static final String MAX_WAIT_SECONDS_PROP - See Also:
- Constant Field Values
 
 - 
STATE_TIMESTAMP_PROPpublic static final String STATE_TIMESTAMP_PROP - See Also:
- Constant Field Values
 
 - 
COLLECTIONS_ZKNODEpublic static final String COLLECTIONS_ZKNODE - See Also:
- Constant Field Values
 
 - 
LIVE_NODES_ZKNODEpublic static final String LIVE_NODES_ZKNODE - See Also:
- Constant Field Values
 
 - 
NODE_ROLESpublic static final String NODE_ROLES The following, node_roles and roles.json are for assigning roles to nodes. The node_roles is the preferred way (using -Dsolr.node.roles param), and roles.json is used by legacy ADDROLE API command.- See Also:
- Constant Field Values
 
 - 
ROLESpublic static final String ROLES - See Also:
- Constant Field Values
 
 - 
ALIASESpublic static final String ALIASES - See Also:
- Constant Field Values
 
 - 
UNSUPPORTED_CLUSTER_STATEpublic static final String UNSUPPORTED_CLUSTER_STATE This ZooKeeper file is no longer used starting with Solr 9 but keeping the name around to check if it is still present and non-empty (in case of upgrade from previous Solr version). It used to contain collection state for all collections in the cluster.- See Also:
- Constant Field Values
 
 - 
CLUSTER_PROPSpublic static final String CLUSTER_PROPS - See Also:
- Constant Field Values
 
 - 
COLLECTION_PROPS_ZKNODEpublic static final String COLLECTION_PROPS_ZKNODE - See Also:
- Constant Field Values
 
 - 
REJOIN_AT_HEAD_PROPpublic static final String REJOIN_AT_HEAD_PROP - See Also:
- Constant Field Values
 
 - 
SOLR_SECURITY_CONF_PATHpublic static final String SOLR_SECURITY_CONF_PATH - See Also:
- Constant Field Values
 
 - 
SOLR_PKGS_PATHpublic static final String SOLR_PKGS_PATH - See Also:
- Constant Field Values
 
 - 
DEFAULT_SHARD_PREFERENCESpublic static final String DEFAULT_SHARD_PREFERENCES - See Also:
- Constant Field Values
 
 - 
REPLICATION_FACTORpublic static final String REPLICATION_FACTOR - See Also:
- Constant Field Values
 
 - 
MAX_CORES_PER_NODEpublic static final String MAX_CORES_PER_NODE - See Also:
- Constant Field Values
 
 - 
PULL_REPLICASpublic static final String PULL_REPLICAS - See Also:
- Constant Field Values
 
 - 
NRT_REPLICASpublic static final String NRT_REPLICAS - See Also:
- Constant Field Values
 
 - 
TLOG_REPLICASpublic static final String TLOG_REPLICAS - See Also:
- Constant Field Values
 
 - 
READ_ONLYpublic static final String READ_ONLY - See Also:
- Constant Field Values
 
 - 
CONFIGS_ZKNODEpublic static final String CONFIGS_ZKNODE - See Also:
- Constant Field Values
 
 - 
CONFIGNAME_PROPpublic static final String CONFIGNAME_PROP - See Also:
- Constant Field Values
 
 - 
URL_SCHEMEpublic static final String URL_SCHEME - See Also:
- Constant Field Values
 
 - 
HTTPpublic static final String HTTP - See Also:
- Constant Field Values
 
 - 
HTTPSpublic static final String HTTPS - See Also:
- Constant Field Values
 
 - 
HTTPS_PORT_PROPpublic static final String HTTPS_PORT_PROP - See Also:
- Constant Field Values
 
 - 
REPLICA_TYPEpublic static final String REPLICA_TYPE - See Also:
- Constant Field Values
 
 - 
CONTAINER_PLUGINSpublic static final String CONTAINER_PLUGINS - See Also:
- Constant Field Values
 
 - 
PLACEMENT_PLUGINpublic static final String PLACEMENT_PLUGIN - See Also:
- Constant Field Values
 
 - 
clusterStateprotected volatile org.apache.solr.common.cloud.ClusterState clusterState A view of the current state of all collections.
 - 
LEADER_ELECT_ZKNODEpublic static final String LEADER_ELECT_ZKNODE - See Also:
- Constant Field Values
 
 - 
SHARD_LEADERS_ZKNODEpublic static final String SHARD_LEADERS_ZKNODE - See Also:
- Constant Field Values
 
 - 
ELECTION_NODEpublic static final String ELECTION_NODE - See Also:
- Constant Field Values
 
 - 
aliasesManagerpublic final ZkStateReader.AliasesManager aliasesManager Access to theAliases.
 
- 
 - 
Constructor Detail- 
ZkStateReaderpublic ZkStateReader(SolrZkClient zkClient) 
 - 
ZkStateReaderpublic ZkStateReader(SolrZkClient zkClient, Runnable securityNodeListener) 
 - 
ZkStateReaderpublic ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout) 
 - 
ZkStateReaderpublic ZkStateReader(String zkServerAddress, int zkClientTimeout, int zkClientConnectTimeout, boolean canUseZkACLs) 
 
- 
 - 
Method Detail- 
frompublic static ZkStateReader from(org.apache.solr.client.solrj.impl.CloudSolrClient solrClient) Gets the ZkStateReader inside a ZK based SolrClient.- Throws:
- IllegalArgumentException- if solrClient isn't ZK based.
 
 - 
forciblyRefreshAllClusterStateSlowpublic void forciblyRefreshAllClusterStateSlow() throws org.apache.zookeeper.KeeperException, InterruptedExceptionForcibly refresh cluster state from ZK. Do this only to avoid race conditions because it's expensive.It is cheaper to call forceUpdateCollection(String)on a single collection if you must.- Throws:
- org.apache.zookeeper.KeeperException
- InterruptedException
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
 
 - 
forceUpdateCollectionpublic void forceUpdateCollection(String collection) throws org.apache.zookeeper.KeeperException, InterruptedException Forcibly refresh a collection's internal state from ZK. Try to avoid having to resort to this when a better design is possible.- Throws:
- org.apache.zookeeper.KeeperException
- InterruptedException
 
 - 
updateLiveNodespublic void updateLiveNodes() throws org.apache.zookeeper.KeeperException, InterruptedExceptionRefresh the set of live nodes.- Throws:
- org.apache.zookeeper.KeeperException
- InterruptedException
 
 - 
createClusterStateWatchersAndUpdatepublic void createClusterStateWatchersAndUpdate() throws org.apache.zookeeper.KeeperException, InterruptedException- Throws:
- org.apache.zookeeper.KeeperException
- InterruptedException
 
 - 
registerCloudCollectionsListenerpublic void registerCloudCollectionsListener(CloudCollectionsListener cloudCollectionsListener) Register a CloudCollectionsListener to be called when the set of collections within a cloud changes.
 - 
removeCloudCollectionsListenerpublic void removeCloudCollectionsListener(CloudCollectionsListener cloudCollectionsListener) Remove a registered CloudCollectionsListener.
 - 
registerClusterPropertiesListenerpublic void registerClusterPropertiesListener(ClusterPropertiesListener listener) 
 - 
removeClusterPropertiesListenerpublic void removeClusterPropertiesListener(ClusterPropertiesListener listener) 
 - 
registerLiveNodesListenerpublic void registerLiveNodesListener(LiveNodesListener listener) 
 - 
removeLiveNodesListenerpublic void removeLiveNodesListener(LiveNodesListener listener) 
 - 
getClusterStatepublic org.apache.solr.common.cloud.ClusterState getClusterState() - Returns:
- information about the cluster from ZooKeeper
 
 - 
getUpdateLockpublic Object getUpdateLock() 
 - 
getZKClientpublic SolrZkClient getZKClient() 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 - 
isClosedpublic boolean isClosed() - Specified by:
- isClosedin interface- org.apache.solr.common.SolrCloseable
 
 - 
getLeaderUrlpublic String getLeaderUrl(String collection, String shard, int timeout) throws InterruptedException - Throws:
- InterruptedException
 
 - 
getLeaderpublic org.apache.solr.common.cloud.Replica getLeader(Set<String> liveNodes, org.apache.solr.common.cloud.DocCollection docCollection, String shard) 
 - 
isNodeLivepublic boolean isNodeLive(String node) 
 - 
getLeaderRetrypublic org.apache.solr.common.cloud.Replica getLeaderRetry(String collection, String shard) throws InterruptedException Get shard leader properties, with retry if none exist.- Throws:
- InterruptedException
 
 - 
getLeaderRetrypublic org.apache.solr.common.cloud.Replica getLeaderRetry(String collection, String shard, int timeout) throws InterruptedException Get shard leader properties, with retry if none exist.- Throws:
- InterruptedException
 
 - 
getShardLeadersPathpublic static String getShardLeadersPath(String collection, String shardId) Get path where shard leader properties live in zookeeper.
 - 
getShardLeadersElectPathpublic static String getShardLeadersElectPath(String collection, String shardId) Get path where shard leader elections ephemeral nodes are.
 - 
getReplicaPropspublic List<org.apache.solr.common.cloud.ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName) 
 - 
getReplicaPropspublic List<org.apache.solr.common.cloud.ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter) 
 - 
getReplicaPropspublic List<org.apache.solr.common.cloud.ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter, org.apache.solr.common.cloud.Replica.State mustNotMatchStateFilter) 
 - 
getReplicaPropspublic List<org.apache.solr.common.cloud.ZkCoreNodeProps> getReplicaProps(String collection, String shardId, String thisCoreNodeName, org.apache.solr.common.cloud.Replica.State mustMatchStateFilter, org.apache.solr.common.cloud.Replica.State mustNotMatchStateFilter, EnumSet<org.apache.solr.common.cloud.Replica.Type> acceptReplicaType) 
 - 
getZkClientpublic SolrZkClient getZkClient() 
 - 
getClusterPropertypublic <T> T getClusterProperty(String key, T defaultValue) Get a cluster propertyN.B. Cluster properties are updated via ZK watchers, and so may not necessarily be completely up-to-date. If you need to get the latest version, then use a ClusterPropertiesinstance.- Type Parameters:
- T- the type of the property
- Parameters:
- key- the property to read
- defaultValue- a default value to use if no such property exists
- Returns:
- the cluster property, or a default if the property is not set
 
 - 
getClusterPropertypublic <T> T getClusterProperty(List<String> keyPath, T defaultValue) Same as the above but allows a full json path as a list of parts- Parameters:
- keyPath- path to the property example ["collectionDefauls", "numShards"]
- defaultValue- a default value to use if no such property exists
- Returns:
- the cluster property, or a default if the property is not set
 
 - 
getClusterPropertiespublic Map<String,Object> getClusterProperties() Get all cluster properties for this clusterN.B. Cluster properties are updated via ZK watchers, and so may not necessarily be completely up-to-date. If you need to get the latest version, then use a ClusterPropertiesinstance.- Returns:
- a Map of cluster properties
 
 - 
getCollectionPropertiespublic Map<String,String> getCollectionProperties(String collection) Get properties for a specific collection
 - 
getCollectionPropertiespublic Map<String,String> getCollectionProperties(String collection, long cacheForMillis) Get and cache collection properties for a given collection
 - 
getSecurityPropspublic ZkStateReader.ConfigData getSecurityProps(boolean getFresh) Returns the content of /security.json from ZooKeeper as a Map If the files doesn't exist, it returns null.
 - 
getBaseUrlForNodeNamepublic String getBaseUrlForNodeName(String nodeName) Returns the baseURL corresponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.- Parameters:
- nodeName- name of the node
- Returns:
- url that looks like https://localhost:8983/solr
 
 - 
getBaseUrlV2ForNodeNamepublic String getBaseUrlV2ForNodeName(String nodeName) Returns the V2 baseURL corresponding to a given node's nodeName -- NOTE: does not (currently) imply that the nodeName (or resulting baseURL) exists in the cluster.- Parameters:
- nodeName- name of the node
- Returns:
- url that looks like https://localhost:8983/api
 
 - 
getCollectionLivepublic org.apache.solr.common.cloud.DocCollection getCollectionLive(String coll) 
 - 
getCollectionPathRoot@Deprecated public static String getCollectionPathRoot(String coll) Deprecated.
 - 
getCollectionPath@Deprecated public static String getCollectionPath(String coll) Deprecated.
 - 
registerCorepublic void registerCore(String collection) Notify this reader that a local Core is a member of a collection, and so that collection state should be watched.Not a public API. This method should only be called from ZkController. The number of cores per-collection is tracked, and adding multiple cores from the same collection does not increase the number of watches. - Parameters:
- collection- the collection that the core is a member of
- See Also:
- unregisterCore(String)
 
 - 
unregisterCorepublic void unregisterCore(String collection) Notify this reader that a local core that is a member of a collection has been closed.Not a public API. This method should only be called from ZkController. If no cores are registered for a collection, and there are no CollectionStateWatchers for that collection either, the collection watch will be removed.- Parameters:
- collection- the collection that the core belongs to
 
 - 
registerCollectionStateWatcherpublic void registerCollectionStateWatcher(String collection, CollectionStateWatcher stateWatcher) Register a CollectionStateWatcher to be called when the state of a collection changes or the set of live nodes changes.The Watcher will automatically be removed when it's onStateChangedreturnstrueThis is method is just syntactic sugar for registering both a DocCollectionWatcherand aLiveNodesListener. Callers that only care about one or the other (but not both) are encouraged to use the more specific methods register methods as it may reduce the number of ZooKeeper watchers needed, and reduce the amount of network/cpu used.- Parameters:
- collection- the collection to watch
- stateWatcher- a watcher that will be called when the state changes
- See Also:
- registerDocCollectionWatcher(java.lang.String, org.apache.solr.common.cloud.DocCollectionWatcher),- registerLiveNodesListener(org.apache.solr.common.cloud.LiveNodesListener)
 
 - 
registerDocCollectionWatcherpublic void registerDocCollectionWatcher(String collection, DocCollectionWatcher docCollectionWatcher) Register a DocCollectionWatcher to be called when the cluster state for a collection changes.The Watcher will automatically be removed when it's onStateChangedreturnstrue
 - 
waitForStatepublic void waitForState(String collection, long wait, TimeUnit unit, org.apache.solr.common.cloud.CollectionStatePredicate predicate) throws InterruptedException, TimeoutException Block until a CollectionStatePredicate returns true, or the wait times outNote that the predicate may be called again even after it has returned true, so implementors should avoid changing state within the predicate call itself. This implementation utilizes CollectionStateWatcherinternally. Callers that don't care about liveNodes are encouraged to use aDocCollectionPredicateinstead- Parameters:
- collection- the collection to watch
- wait- how long to wait
- unit- the units of the wait parameter
- predicate- the predicate to call on state changes
- Throws:
- InterruptedException- on interrupt
- TimeoutException- on timeout
- See Also:
- waitForState(String, long, TimeUnit, Predicate),- registerCollectionStateWatcher(java.lang.String, org.apache.solr.common.cloud.CollectionStateWatcher)
 
 - 
waitForStatepublic org.apache.solr.common.cloud.DocCollection waitForState(String collection, long wait, TimeUnit unit, Predicate<org.apache.solr.common.cloud.DocCollection> predicate) throws InterruptedException, TimeoutException Block until a Predicate returns true, or the wait times outNote that the predicate may be called again even after it has returned true, so implementors should avoid changing state within the predicate call itself. The predicate may also be called concurrently when multiple state changes are seen in rapid succession. - Parameters:
- collection- the collection to watch
- wait- how long to wait
- unit- the units of the wait parameter
- predicate- the predicate to call on state changes
- Returns:
- the state of the doc collection after the predicate succeeds
- Throws:
- InterruptedException- on interrupt
- TimeoutException- on timeout
 
 - 
waitForLiveNodespublic void waitForLiveNodes(long wait, TimeUnit unit, LiveNodesPredicate predicate) throws InterruptedException, TimeoutExceptionBlock until a LiveNodesStatePredicate returns true, or the wait times outNote that the predicate may be called again even after it has returned true, so implementors should avoid changing state within the predicate call itself. - Parameters:
- wait- how long to wait
- unit- the units of the wait parameter
- predicate- the predicate to call on state changes
- Throws:
- InterruptedException- on interrupt
- TimeoutException- on timeout
 
 - 
removeCollectionStateWatcherpublic void removeCollectionStateWatcher(String collection, CollectionStateWatcher watcher) Remove a watcher from a collection's watch list.This allows Zookeeper watches to be removed if there is no interest in the collection. - Parameters:
- collection- the collection
- watcher- the watcher
- See Also:
- registerCollectionStateWatcher(java.lang.String, org.apache.solr.common.cloud.CollectionStateWatcher)
 
 - 
removeDocCollectionWatcherpublic void removeDocCollectionWatcher(String collection, DocCollectionWatcher watcher) Remove a watcher from a collection's watch list.This allows Zookeeper watches to be removed if there is no interest in the collection. - Parameters:
- collection- the collection
- watcher- the watcher
- See Also:
- registerDocCollectionWatcher(java.lang.String, org.apache.solr.common.cloud.DocCollectionWatcher)
 
 - 
registerCollectionPropsWatcherpublic void registerCollectionPropsWatcher(String collection, CollectionPropsWatcher propsWatcher) 
 - 
removeCollectionPropsWatcherpublic void removeCollectionPropsWatcher(String collection, CollectionPropsWatcher watcher) 
 - 
getAliasespublic org.apache.solr.common.cloud.Aliases getAliases() Get an immutable copy of the present state of the aliases. References to this object should not be retained in any context where it will be important to know if aliases have changed.- Returns:
- The current aliases, Aliases.EMPTY if not solr cloud, or no aliases have existed yet. Never returns null.
 
 - 
getAliasesManagerpublic ZkStateReader.AliasesManager getAliasesManager() 
 - 
getCollectionpublic org.apache.solr.common.cloud.DocCollection getCollection(String collection) 
 
- 
 
-