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 void
close()
void
connect()
static org.apache.solr.common.cloud.ClusterState
createFromJsonSupportingLegacyConfigName(int version, byte[] bytes, Set<String> liveNodes, String coll, SolrZkClient zkClient)
Deprecated.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.Map<String,String>
getAliasProperties(String alias)
Map<String,Object>
getClusterProperties()
Object
getClusterProperty(String propertyName)
<T> T
getClusterProperty(String propertyName, T def)
org.apache.solr.common.cloud.ClusterState
getClusterState()
Set<String>
getLiveNodes()
String
getPolicyNameByCollection(String coll)
String
getQuorumHosts()
org.apache.solr.common.cloud.ClusterState.CollectionRef
getState(String collection)
int
getZkClientTimeout()
int
getZkConnectTimeout()
String
getZkHost()
ZkStateReader
getZkStateReader()
boolean
isClosed()
List<String>
resolveAlias(String alias)
String
resolveSimpleAlias(String alias)
void
setZkClientTimeout(int zkClientTimeout)
Set the timeout to the zookeeper ensemble in msvoid
setZkConnectTimeout(int zkConnectTimeout)
Set the connect timeout to the zookeeper ensemble in msString
toString()
-
-
-
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 aDocCollection
as 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:
getState
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getLiveNodes
public Set<String> getLiveNodes()
- Specified by:
getLiveNodes
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
resolveAlias
public List<String> resolveAlias(String alias)
- Specified by:
resolveAlias
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getAliasProperties
public Map<String,String> getAliasProperties(String alias)
- Specified by:
getAliasProperties
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
resolveSimpleAlias
public String resolveSimpleAlias(String alias) throws IllegalArgumentException
- Specified by:
resolveSimpleAlias
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
- Throws:
IllegalArgumentException
-
getClusterProperty
public Object getClusterProperty(String propertyName)
- Specified by:
getClusterProperty
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterProperty
public <T> T getClusterProperty(String propertyName, T def)
- Specified by:
getClusterProperty
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterState
public org.apache.solr.common.cloud.ClusterState getClusterState()
- Specified by:
getClusterState
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getClusterProperties
public Map<String,Object> getClusterProperties()
- Specified by:
getClusterProperties
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getPolicyNameByCollection
public String getPolicyNameByCollection(String coll)
- Specified by:
getPolicyNameByCollection
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
connect
public void connect()
- Specified by:
connect
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
getZkStateReader
public ZkStateReader getZkStateReader()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getQuorumHosts
public String getQuorumHosts()
- Specified by:
getQuorumHosts
in interfaceorg.apache.solr.client.solrj.impl.ClusterStateProvider
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in 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
-
-