Class CachedSolrClient

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Serializable, java.lang.AutoCloseable

    public class CachedSolrClient
    extends org.apache.solr.client.solrj.SolrClient
    The cached SolrClient instance. This is a wrapper around the real SolrClient.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate)  
      CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate, java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod, org.apache.http.auth.Credentials credentials)  
      CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate, org.apache.http.auth.Credentials credentials)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addConsumer()
      Notifies this client that there is a new consumer.
      void close()
      Notifies this client to remove one consumer.
      java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> getCloseMethod()
      Returns the method used to release resources associated with the delegate Solr client.
      protected org.apache.http.auth.Credentials getCredentials()
      Returns the credentials that will be used for authentication.
      org.apache.solr.client.solrj.SolrClient getDelegate()
      Returns the delegate Solr client.
      org.apache.solr.common.util.NamedList<java.lang.Object> request​(org.apache.solr.client.solrj.SolrRequest solrRequest, java.lang.String collection)  
      • Methods inherited from class org.apache.solr.client.solrj.SolrClient

        add, add, add, add, add, add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, deleteByQuery, deleteByQuery, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, optimize, optimize, optimize, optimize, optimize, optimize, ping, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachedSolrClient

        public CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate)
      • CachedSolrClient

        public CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate,
                                org.apache.http.auth.Credentials credentials)
      • CachedSolrClient

        public CachedSolrClient​(org.apache.solr.client.solrj.SolrClient delegate,
                                java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> closeMethod,
                                org.apache.http.auth.Credentials credentials)
    • Method Detail

      • request

        public org.apache.solr.common.util.NamedList<java.lang.Object> request​(org.apache.solr.client.solrj.SolrRequest solrRequest,
                                                                               java.lang.String collection)
                                                                        throws org.apache.solr.client.solrj.SolrServerException,
                                                                               java.io.IOException
        Specified by:
        request in class org.apache.solr.client.solrj.SolrClient
        Throws:
        org.apache.solr.client.solrj.SolrServerException
        java.io.IOException
      • close

        public void close()
        Notifies this client to remove one consumer. If this client is no longer required (consumersNumber < 0), Closeable.close() is called on the delegate client.
      • addConsumer

        public void addConsumer()
        Notifies this client that there is a new consumer.
      • getDelegate

        public org.apache.solr.client.solrj.SolrClient getDelegate()
        Returns the delegate Solr client.
        Returns:
        the delegate Solr client
      • getCloseMethod

        public java.util.function.Consumer<org.apache.solr.client.solrj.SolrClient> getCloseMethod()
        Returns the method used to release resources associated with the delegate Solr client.
        Returns:
        the close method
      • getCredentials

        protected org.apache.http.auth.Credentials getCredentials()
        Returns the credentials that will be used for authentication.
        Returns:
        the credentials