Class ConcurrentUpdateSolrClient

  • All Implemented Interfaces:
    Closeable, Serializable, AutoCloseable

    public class ConcurrentUpdateSolrClient
    extends SolrClient
    ConcurrentUpdateSolrClient buffers all added documents and writes them into open HTTP connections. This class is thread safe. Params from UpdateRequest are converted to http request parameters. When params change between UpdateRequests a new HTTP request is started. Although any SolrClient request can be made with this implementation, it is only recommended to use ConcurrentUpdateSolrClient with /update requests. The class HttpSolrClient is better suited for the query interface.
    See Also:
    Serialized Form
    • Constructor Detail

      • ConcurrentUpdateSolrClient

        protected ConcurrentUpdateSolrClient​(String solrServerUrl,
                                             org.apache.http.client.HttpClient client,
                                             int queueSize,
                                             int threadCount,
                                             ExecutorService es,
                                             boolean streamDeletes)
        use ConcurrentUpdateSolrClient(Builder) instead, as it is a more extension/subclassing-friendly alternative
        Uses the supplied HttpClient to send documents to the Solr server.
    • Method Detail

      • getQueryParams

        public Set<String> getQueryParams()
      • setQueryParams

        public void setQueryParams​(Set<String> queryParams)
        Expert Method.
        queryParams - set of param keys to only send via the query string
      • blockUntilFinished

        public void blockUntilFinished()
      • handleError

        public void handleError​(Throwable ex)
      • onSuccess

        public void onSuccess​(org.apache.http.HttpResponse resp)
        Intended to be used as an extension point for doing post processing after a request completes.
      • close

        public void close()
      • setSoTimeout

        public void setSoTimeout​(int timeout)
        since 7.0 Use ConcurrentUpdateSolrClient.Builder methods instead.
        set soTimeout (read timeout) on the underlying HttpConnectionManager. This is desirable for queries, but probably not for indexing.
      • shutdownNow

        public void shutdownNow()
      • setParser

        public void setParser​(ResponseParser responseParser)
      • setPollQueueTime

        public void setPollQueueTime​(int pollQueueTime)
        pollQueueTime - time for an open connection to wait for updates when the queue is empty.
      • setRequestWriter

        public void setRequestWriter​(RequestWriter requestWriter)