org.apache.solr.client.solrj.impl

## Class ConcurrentUpdateSolrClient

- java.lang.Object
- - org.apache.solr.client.solrj.SolrClient
  - - org.apache.solr.client.solrj.impl.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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ConcurrentUpdateSolrClient.Builder` Constructs `ConcurrentUpdateSolrClient` instances from provided configuration.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConcurrentUpdateSolrClient(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount)` Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.
    `ConcurrentUpdateSolrClient(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount, ExecutorService es)` Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.
    `ConcurrentUpdateSolrClient(String solrServerUrl, org.apache.http.client.HttpClient client, int queueSize, int threadCount, ExecutorService es, boolean streamDeletes)` Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead. This will soon be a protected method, and will only be available for use in implementing subclasses.
    `ConcurrentUpdateSolrClient(String solrServerUrl, int queueSize, int threadCount)` Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `blockUntilFinished()`
    `void` | `close()`
    `Set<String>` | `getQueryParams()`
    `void` | `handleError(Throwable ex)`
    `void` | `onSuccess(org.apache.http.HttpResponse resp)` Intended to be used as an extension point for doing post processing after a request completes.
    `NamedList<Object>` | `request(SolrRequest request, String collection)` Execute a request against a Solr server for a given collection
    `void` | `setConnectionTimeout(int timeout)`
    `void` | `setParser(ResponseParser responseParser)`
    `void` | `setPollQueueTime(int pollQueueTime)`
    `void` | `setQueryParams(Set<String> queryParams)` Expert Method.
    `void` | `setRequestWriter(RequestWriter requestWriter)`
    `void` | `setSoTimeout(int timeout)` set soTimeout (read timeout) on the underlying HttpConnectionManager.
    `void` | `shutdownNow()`

    - ### 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, query, query, query, query, 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

    - #### ConcurrentUpdateSolrClient

          @Deprecated
          public ConcurrentUpdateSolrClient(String solrServerUrl,
                                                        int queueSize,
                                                        int threadCount)

      Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.
      Uses an internally managed HttpClient instance.
      Parameters:
        `solrServerUrl` - The Solr server URL
        `queueSize` - The buffer size before the documents are sent to the server
        `threadCount` - The number of background threads used to empty the queue

    - #### ConcurrentUpdateSolrClient

          @Deprecated
          public ConcurrentUpdateSolrClient(String solrServerUrl,
                                                        org.apache.http.client.HttpClient client,
                                                        int queueSize,
                                                        int threadCount)

      Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.

    - #### ConcurrentUpdateSolrClient

          @Deprecated
          public ConcurrentUpdateSolrClient(String solrServerUrl,
                                                        org.apache.http.client.HttpClient client,
                                                        int queueSize,
                                                        int threadCount,
                                                        ExecutorService es)

      Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead.
      Uses the supplied HttpClient to send documents to the Solr server.

    - #### ConcurrentUpdateSolrClient

          @Deprecated
          public ConcurrentUpdateSolrClient(String solrServerUrl,
                                                        org.apache.http.client.HttpClient client,
                                                        int queueSize,
                                                        int threadCount,
                                                        ExecutorService es,
                                                        boolean streamDeletes)

      Deprecated. use `ConcurrentUpdateSolrClient.Builder` instead. This will soon be a protected method, and will only be available for use in implementing subclasses.
      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.
      Parameters:
        `queryParams` - set of param keys to only send via the query string

    - #### request

          public NamedList<Object> request(SolrRequest request,
                                           String collection)
                                    throws SolrServerException,
                                           IOException

      Description copied from class: `SolrClient`
      Execute a request against a Solr server for a given collection
      Specified by:
        `request` in class `SolrClient`
      Parameters:
        `request` - the request to execute
        `collection` - the collection to execute the request against
      Returns:
        a `NamedList` containing the response from the server
      Throws:
        `SolrServerException` - if there is an error on the server
        `IOException` - If there is a low-level I/O error.

    - #### 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()

    - #### setConnectionTimeout

          public void setConnectionTimeout(int timeout)

    - #### setSoTimeout

          public void setSoTimeout(int timeout)

      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)

      Parameters:
        `pollQueueTime` - time for an open connection to wait for updates when the queue is empty.

    - #### setRequestWriter

          public void setRequestWriter(RequestWriter requestWriter)

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.