Class ConcurrentUpdateBaseSolrClient.Builder
- Enclosing class:
ConcurrentUpdateBaseSolrClient
ConcurrentUpdateBaseSolrClient instances from provided configuration.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected HttpSolrClientBaseprotected booleanprotected Stringprotected ExecutorServiceprotected longprotected longprotected intprotected booleanprotected int -
Constructor Summary
ConstructorsConstructorDescriptionBuilder(String baseSolrUrl, HttpSolrClientBase client) Initialize a Builder object, based on the provided URL and client.Builder(String baseSolrUrl, HttpSolrClientBase client, boolean closeHttpClient) Initialize a Builder object, based on the provided arguments. -
Method Summary
Modifier and TypeMethodDescriptionConfigures created clients to always stream delete requests.abstract ConcurrentUpdateBaseSolrClientbuild()Create aConcurrentUpdateBaseSolrClientbased on the provided configuration options.Configures created clients to not stream delete requests.setPollQueueTime(long pollQueueTime, TimeUnit unit) withDefaultCollection(String defaultCoreOrCollection) Sets a default for core or collection based requests.withExecutorService(ExecutorService executorService) Provides theExecutorServicefor the created client to use when servicing the update-request queue.withQueueSize(int queueSize) The maximum number of requests buffered by the SolrClient's internal queue before being processed by background threads.withThreadCount(int threadCount) The maximum number of threads used to emptyConcurrentUpdateBaseSolrClients queue.
-
Field Details
-
idleTimeoutMillis
protected long idleTimeoutMillis -
client
-
baseSolrUrl
-
defaultCollection
-
queueSize
protected int queueSize -
threadCount
protected int threadCount -
executorService
-
streamDeletes
protected boolean streamDeletes -
closeHttpClient
protected boolean closeHttpClient -
pollQueueTimeMillis
protected long pollQueueTimeMillis
-
-
Constructor Details
-
Builder
Initialize a Builder object, based on the provided URL and client.The provided URL must point to the root Solr path (i.e. "/solr"), for example:
SolrClient client = new ConcurrentUpdateJettySolrClient.Builder("http://my-solr-server:8983/solr", http2Client) .withDefaultCollection("core1") .build(); QueryResponse resp = client.query(new SolrQuery("*:*"));- Parameters:
baseSolrUrl- a URL pointing to the root Solr path, typically of the form "http[s]://host:port/solr"client- a client for this ConcurrentUpdateJettySolrClient to use for all requests internally. Callers are responsible for closing the provided client (after closing any clients created by this builder)
-
Builder
Initialize a Builder object, based on the provided arguments.The provided URL must point to the root Solr path (i.e. "/solr"), for example:
SolrClient client = new ConcurrentUpdateJettySolrClient.Builder("http://my-solr-server:8983/solr", http2Client) .withDefaultCollection("core1") .build(); QueryResponse resp = client.query(new SolrQuery("*:*"));- Parameters:
baseSolrUrl- a URL pointing to the root Solr path, typically of the form "http[s]://host:port/solr"client- a client for this ConcurrentUpdateJettySolrClient to use for all requests internally.closeHttpClient- a boolean flag indicating whether the created ConcurrentUpdateBaseSolrClient should assume responsibility for closing the provided 'client'
-
-
Method Details
-
withQueueSize
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
The maximum number of threads used to emptyConcurrentUpdateBaseSolrClients queue.Threads are created when documents are added to the client's internal queue and exit when no updates remain in the 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
Provides theExecutorServicefor the created client to use when servicing the update-request queue. -
alwaysStreamDeletes
Configures created clients to always stream delete requests.Streamed deletes are put into the update-queue and executed like any other update request.
-
neverStreamDeletes
Configures created clients to not stream delete requests.With this option set when the created ConcurrentUpdateBaseSolrClient sends a delete request it will first will lock the queue and block until all queued updates have been sent, and then send the delete request.
-
withDefaultCollection
Sets a default for core or collection based requests. -
setPollQueueTime
- Parameters:
pollQueueTime- time for an open connection to wait for updates when the queue is empty.
-
build
Create aConcurrentUpdateBaseSolrClientbased on the provided configuration options. -
getClient
-