Class KafkaCrossDcConsumer.SolrClientSupplier

java.lang.Object
org.apache.solr.crossdc.manager.consumer.KafkaCrossDcConsumer.SolrClientSupplier
All Implemented Interfaces:
AutoCloseable, Supplier<org.apache.solr.client.solrj.impl.CloudSolrClient>
Enclosing class:
KafkaCrossDcConsumer

public static class KafkaCrossDcConsumer.SolrClientSupplier extends Object implements Supplier<org.apache.solr.client.solrj.impl.CloudSolrClient>, AutoCloseable
Supplier for creating and managing a working CloudSolrClient instance. This class ensures that the CloudSolrClient instance doesn't try to use its ZkClientClusterStateProvider in a closed state, which may happen if e.g. the ZooKeeper connection is lost. When this happens the CloudSolrClient is re-created to ensure it can continue to function properly.

TODO: this functionality should be moved to the CloudSolrClient itself.

  • Constructor Details

    • SolrClientSupplier

      public SolrClientSupplier(String zkConnectString)
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • createSolrClient

      protected org.apache.solr.client.solrj.impl.CloudSolrClient createSolrClient()
    • get

      public org.apache.solr.client.solrj.impl.CloudSolrClient get()
      Specified by:
      get in interface Supplier<org.apache.solr.client.solrj.impl.CloudSolrClient>