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.common.SolrCloseable
public class ZkClientClusterStateProvider extends Object implements org.apache.solr.client.solrj.impl.ClusterStateProvider
Retrieves cluster state from Zookeeper 
- 
- 
Constructor Summary
Constructors Constructor Description ZkClientClusterStateProvider(String zkHost)ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)ZkClientClusterStateProvider(ZkStateReader zkStateReader) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()voidconnect()static org.apache.solr.common.cloud.ClusterStatecreateFromJsonSupportingLegacyConfigName(int version, byte[] bytes, Set<String> liveNodes, String coll, SolrZkClient zkClient)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.Map<String,String>getAliasProperties(String alias)Map<String,Object>getClusterProperties()ObjectgetClusterProperty(String propertyName)<T> TgetClusterProperty(String propertyName, T def)org.apache.solr.common.cloud.ClusterStategetClusterState()Set<String>getLiveNodes()StringgetPolicyNameByCollection(String coll)StringgetQuorumHosts()org.apache.solr.common.cloud.ClusterState.CollectionRefgetState(String collection)intgetZkClientTimeout()intgetZkConnectTimeout()StringgetZkHost()ZkStateReadergetZkStateReader()booleanisClosed()List<String>resolveAlias(String alias)StringresolveSimpleAlias(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 msStringtoString() 
 - 
 
- 
- 
Constructor Detail
- 
ZkClientClusterStateProvider
public ZkClientClusterStateProvider(ZkStateReader zkStateReader)
 
- 
ZkClientClusterStateProvider
public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)
 
- 
ZkClientClusterStateProvider
public ZkClientClusterStateProvider(String zkHost)
 
 - 
 
- 
Method Detail
- 
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)
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 byClusterState.write(JSONWriter). It can represent one or more collections.liveNodes- list of live nodescoll- collection namezkClient- ZK client- Returns:
 - the ClusterState
 
 
- 
getState
public org.apache.solr.common.cloud.ClusterState.CollectionRef getState(String collection)
- Specified by:
 getStatein interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
getLiveNodes
public Set<String> getLiveNodes()
- Specified by:
 getLiveNodesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
resolveAlias
public List<String> resolveAlias(String alias)
- Specified by:
 resolveAliasin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
getAliasProperties
public Map<String,String> getAliasProperties(String alias)
- Specified by:
 getAliasPropertiesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
resolveSimpleAlias
public String resolveSimpleAlias(String alias) throws IllegalArgumentException
- Specified by:
 resolveSimpleAliasin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider- Throws:
 IllegalArgumentException
 
- 
getClusterProperty
public Object getClusterProperty(String propertyName)
- Specified by:
 getClusterPropertyin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
getClusterProperty
public <T> T getClusterProperty(String propertyName, T def)
- 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
public Map<String,Object> getClusterProperties()
- Specified by:
 getClusterPropertiesin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
getPolicyNameByCollection
public String getPolicyNameByCollection(String coll)
- 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
public ZkStateReader getZkStateReader()
 
- 
close
public void close() throws IOException- Specified by:
 closein interfaceAutoCloseable- Specified by:
 closein interfaceCloseable- Throws:
 IOException
 
- 
getQuorumHosts
public String getQuorumHosts()
- Specified by:
 getQuorumHostsin interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
 
- 
isClosed
public boolean isClosed()
- Specified by:
 isClosedin interfaceorg.apache.solr.common.SolrCloseable
 
- 
getZkHost
public String 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 
- 
getZkClientTimeout
public int getZkClientTimeout()
 
- 
setZkClientTimeout
public void setZkClientTimeout(int zkClientTimeout)
Set the timeout to the zookeeper ensemble in ms 
 - 
 
 -