Class ZkClientClusterStateProvider
java.lang.Object
org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.solr.client.solrj.impl.ClusterStateProvider,org.apache.solr.client.solrj.impl.SolrZkClientTimeout.SolrZkClientTimeoutAware,org.apache.solr.common.SolrCloseable
public class ZkClientClusterStateProvider
extends Object
implements org.apache.solr.client.solrj.impl.ClusterStateProvider, org.apache.solr.client.solrj.impl.SolrZkClientTimeout.SolrZkClientTimeoutAware
Retrieves cluster state from Zookeeper
-
Constructor Summary
ConstructorsConstructorDescriptionZkClientClusterStateProvider(String zkHost) ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot) ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot, boolean canUseZkACLs) ZkClientClusterStateProvider(ZkStateReader zkStateReader) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidconnect()static org.apache.solr.common.cloud.ClusterStatecreateFromJsonSupportingLegacyConfigName(int version, byte[] bytes, Set<String> liveNodes, String coll, SolrZkClient zkClient, Instant createTime) Deprecated.static ZkClientClusterStateProviderfrom(org.apache.solr.client.solrj.impl.CloudSolrClient client) Extracts this from the client, or throws an exception if of the wrong type.getAliasProperties(String alias) getClusterProperty(String propertyName) <T> TgetClusterProperty(String propertyName, T def) org.apache.solr.common.cloud.ClusterStateorg.apache.solr.common.cloud.ClusterState.CollectionRefintintbooleanisClosed()resolveAlias(String alias) resolveSimpleAlias(String alias) voidsetZkClientTimeout(int zkClientTimeout) Set the timeout to the zookeeper ensemble in msvoidsetZkConnectTimeout(int zkConnectTimeout) Set the connect timeout to the zookeeper ensemble in mstoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.solr.client.solrj.impl.ClusterStateProvider
getCollection, isRoutedAlias
-
Constructor Details
-
ZkClientClusterStateProvider
-
ZkClientClusterStateProvider
-
ZkClientClusterStateProvider
public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot, boolean canUseZkACLs) -
ZkClientClusterStateProvider
-
-
Method Details
-
from
public static ZkClientClusterStateProvider from(org.apache.solr.client.solrj.impl.CloudSolrClient client) Extracts this from the client, or throws an exception if of the wrong type. -
createFromJsonSupportingLegacyConfigName
@Deprecated public static org.apache.solr.common.cloud.ClusterState createFromJsonSupportingLegacyConfigName(int version, byte[] bytes, Set<String> liveNodes, String coll, SolrZkClient zkClient, Instant createTime) Deprecated.Create a ClusterState from Json. This method supports legacy configName location- Parameters:
bytes- a byte array of a Json representation of a mapping from collection name to the Json representation of aDocCollectionas written byMapWriter.write(JSONWriter). It can represent one or more collections.liveNodes- list of live nodescoll- collection namezkClient- ZK clientcreateTime- creation time of the data/bytes- Returns:
- the ClusterState
-
getState
- Specified by:
getStatein interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getLiveNodes
- Specified by:
getLiveNodesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
resolveAlias
- Specified by:
resolveAliasin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getAliasProperties
- Specified by:
getAliasPropertiesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
resolveSimpleAlias
- Specified by:
resolveSimpleAliasin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider- Throws:
IllegalArgumentException
-
getClusterProperty
- Specified by:
getClusterPropertyin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterProperty
- Specified by:
getClusterPropertyin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterState
public org.apache.solr.common.cloud.ClusterState getClusterState()- Specified by:
getClusterStatein interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterProperties
- Specified by:
getClusterPropertiesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getPolicyNameByCollection
- Specified by:
getPolicyNameByCollectionin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
connect
public void connect()- Specified by:
connectin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getZkStateReader
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getQuorumHosts
- Specified by:
getQuorumHostsin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
toString
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceorg.apache.solr.common.SolrCloseable
-
getZkHost
- Returns:
- the zkHost value used to connect to zookeeper.
-
getZkConnectTimeout
public int getZkConnectTimeout() -
setZkConnectTimeout
public void setZkConnectTimeout(int zkConnectTimeout) Set the connect timeout to the zookeeper ensemble in ms- Specified by:
setZkConnectTimeoutin interfaceorg.apache.solr.client.solrj.impl.SolrZkClientTimeout.SolrZkClientTimeoutAware
-
getZkClientTimeout
public int getZkClientTimeout() -
setZkClientTimeout
public void setZkClientTimeout(int zkClientTimeout) Set the timeout to the zookeeper ensemble in ms- Specified by:
setZkClientTimeoutin interfaceorg.apache.solr.client.solrj.impl.SolrZkClientTimeout.SolrZkClientTimeoutAware
-