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 Details

    • ZkClientClusterStateProvider

      public ZkClientClusterStateProvider(ZkStateReader zkStateReader)
    • ZkClientClusterStateProvider

      public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot)
    • ZkClientClusterStateProvider

      public ZkClientClusterStateProvider(Collection<String> zkHosts, String chroot, boolean canUseZkACLs)
    • ZkClientClusterStateProvider

      public ZkClientClusterStateProvider(String zkHost)
  • 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 a DocCollection as written by MapWriter.write(JSONWriter). It can represent one or more collections.
      liveNodes - list of live nodes
      coll - collection name
      zkClient - ZK client
      createTime - creation time of the data/bytes
      Returns:
      the ClusterState
    • getState

      public org.apache.solr.common.cloud.ClusterState.CollectionRef getState(String collection)
      Specified by:
      getState in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getLiveNodes

      public Set<String> getLiveNodes()
      Specified by:
      getLiveNodes in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • resolveAlias

      public List<String> resolveAlias(String alias)
      Specified by:
      resolveAlias in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getAliasProperties

      public Map<String,String> getAliasProperties(String alias)
      Specified by:
      getAliasProperties in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • resolveSimpleAlias

      public String resolveSimpleAlias(String alias) throws IllegalArgumentException
      Specified by:
      resolveSimpleAlias in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      Throws:
      IllegalArgumentException
    • getClusterProperty

      public Object getClusterProperty(String propertyName)
      Specified by:
      getClusterProperty in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getClusterProperty

      public <T> T getClusterProperty(String propertyName, T def)
      Specified by:
      getClusterProperty in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getClusterState

      public org.apache.solr.common.cloud.ClusterState getClusterState()
      Specified by:
      getClusterState in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getClusterProperties

      public Map<String,Object> getClusterProperties()
      Specified by:
      getClusterProperties in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getPolicyNameByCollection

      public String getPolicyNameByCollection(String coll)
      Specified by:
      getPolicyNameByCollection in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • connect

      public void connect()
      Specified by:
      connect in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • getZkStateReader

      public ZkStateReader getZkStateReader()
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getQuorumHosts

      public String getQuorumHosts()
      Specified by:
      getQuorumHosts in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface org.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
      Specified by:
      setZkConnectTimeout in interface org.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:
      setZkClientTimeout in interface org.apache.solr.client.solrj.impl.SolrZkClientTimeout.SolrZkClientTimeoutAware