org.apache.solr.client.solrj.impl

## Class ConcurrentUpdateSolrClient.Builder

- java.lang.Object
- - org.apache.solr.client.solrj.impl.SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>
  - - org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder

Enclosing class:
  ConcurrentUpdateSolrClient

    public static class ConcurrentUpdateSolrClient.Builder
    extends SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>

Constructs `ConcurrentUpdateSolrClient` instances from provided configuration.

### Field Summary

Fields
`protected String` `baseSolrUrl`
`protected ExecutorService` `executorService`
`protected int` `queueSize`
`protected boolean` `streamDeletes`
`protected int` `threadCount`

### Fields inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilder

`connectionTimeoutMillis, httpClient, responseParser, socketTimeoutMillis`

### Constructor Summary

Constructors
Constructor and Description
`Builder(String baseSolrUrl)` Create a Builder object, based on the provided Solr URL.

### Method Summary

All Methods Instance Methods Concrete Methods
`ConcurrentUpdateSolrClient.Builder` `alwaysStreamDeletes()` Configures created clients to always stream delete requests.
`ConcurrentUpdateSolrClient` `build()` Create a `ConcurrentUpdateSolrClient` based on the provided configuration options.
`ConcurrentUpdateSolrClient.Builder` `getThis()` The solution for the unchecked cast warning.
`ConcurrentUpdateSolrClient.Builder` `neverStreamDeletes()` Configures created clients to not stream delete requests.
`ConcurrentUpdateSolrClient.Builder` `withExecutorService(ExecutorService executorService)` Provides the `ExecutorService` for clients to use when servicing requests.
`ConcurrentUpdateSolrClient.Builder` `withQueueSize(int queueSize)` The maximum number of requests buffered by the SolrClient's internal queue before being processed by background threads.
`ConcurrentUpdateSolrClient.Builder` `withThreadCount(int threadCount)` The maximum number of threads used to empty `ConcurrentUpdateSolrClient`s queue.

### Methods inherited from class org.apache.solr.client.solrj.impl.SolrClientBuilder

`withConnectionTimeout, withHttpClient, withResponseParser, withSocketTimeout`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### baseSolrUrl

    protected String baseSolrUrl

#### queueSize

    protected int queueSize

#### threadCount

    protected int threadCount

#### executorService

    protected ExecutorService executorService

#### streamDeletes

    protected boolean streamDeletes

### Constructor Detail

#### Builder

    public Builder(String baseSolrUrl)

Create a Builder object, based on the provided Solr URL. Two different paths can be specified as a part of this URL: 1) A path pointing directly at a particular core

       SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://my-solr-server:8983/solr/core1").build();
       QueryResponse resp = client.query(new SolrQuery("*:*"));

Note that when a core is provided in the base URL, queries and other requests can be made without mentioning the core explicitly. However, the client can only send requests to that core. 2) The path of the root Solr path ("/solr")

       SolrClient client = new ConcurrentUpdateSolrClient.Builder("http://my-solr-server:8983/solr").build();
       QueryResponse resp = client.query("core1", new SolrQuery("*:*"));

In this case the client is more flexible and can be used to send requests to any cores. This flexibility though requires that the core be specified on all requests.

### Method Detail

#### withQueueSize

    public ConcurrentUpdateSolrClient.Builder withQueueSize(int queueSize)

The maximum number of requests buffered by the SolrClient's internal queue before being processed by background threads. This value should be carefully paired with the number of queue-consumer threads. A queue with a maximum size set too high may require more memory. A queue with a maximum size set too low may suffer decreased throughput as `SolrClient.request(SolrRequest)` calls block waiting to add requests to the queue. If not set, this defaults to 10.

See Also:
  `withThreadCount(int)`

#### withThreadCount

    public ConcurrentUpdateSolrClient.Builder withThreadCount(int threadCount)

The maximum number of threads used to empty `ConcurrentUpdateSolrClient`s queue. This value should be carefully paired with the maximum queue capacity. A client with too few threads may suffer decreased throughput as the queue fills up and `SolrClient.request(SolrRequest)` calls block waiting to add requests to the queue.

#### withExecutorService

    public ConcurrentUpdateSolrClient.Builder withExecutorService(ExecutorService executorService)

Provides the `ExecutorService` for clients to use when servicing requests.

#### alwaysStreamDeletes

    public ConcurrentUpdateSolrClient.Builder alwaysStreamDeletes()

Configures created clients to always stream delete requests.

#### neverStreamDeletes

    public ConcurrentUpdateSolrClient.Builder neverStreamDeletes()

Configures created clients to not stream delete requests.

#### build

    public ConcurrentUpdateSolrClient build()

Create a `ConcurrentUpdateSolrClient` based on the provided configuration options.

#### getThis

    public ConcurrentUpdateSolrClient.Builder getThis()

Description copied from class: `SolrClientBuilder`
The solution for the unchecked cast warning.

Specified by:
  `getThis` in class `SolrClientBuilder<ConcurrentUpdateSolrClient.Builder>`