[
https://issues.apache.org/jira/browse/SOLR-7127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14329088#comment-14329088
]
Mark Miller commented on SOLR-7127:
-----------------------------------
bq. CloudSolrClient isn't thread-safe if you're making requests to multiple
collections, because defaultCollection is mutable.
defaultCollection is of course not meant to be changed - it would be called
just collection if it was - it's just meant to be set and then you override
what collection to use per request. It's only not a constructor arg to avoid
constructor hell. We make this simple tradeoff in many places - it's often
preferable to constructors with tons of params and alternate versions or over
complicated builder patterns. You see the same thing on most of the SolrClient
impls.
Anyway, are we sure this whole parent / child / juggle lots of clients is
really better than adding some new methods that allow passing the collection to
use?
> Add method to CloudSolrClient to create per-collection clients
> --------------------------------------------------------------
>
> Key: SOLR-7127
> URL: https://issues.apache.org/jira/browse/SOLR-7127
> Project: Solr
> Issue Type: Improvement
> Reporter: Alan Woodward
> Assignee: Alan Woodward
> Priority: Minor
> Attachments: SOLR-7127.patch, SOLR-7127.patch
>
>
> CloudSolrClient isn't thread-safe if you're making requests to multiple
> collections, because defaultCollection is mutable. This can be a pain if
> you're trying to index into multiple collections from a single queue of
> documents.
> This issue adds a .getCollectionClient(String) method to CloudSolrClient that
> returns a child client directed at that collection. Under the hood it's
> another CloudSolrClient sharing it's resources with the parent client, but
> with a separate default collection set. The method returns a SolrClient,
> however, so you can't then change the collection unless you explicitly cast
> it.
> Sort of related to what I wanted to do on SOLR-6894, but this is more
> focussed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]