You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shawn Heisey (JIRA)" <ji...@apache.org> on 2015/02/22 02:34:11 UTC

[jira] [Comment Edited] (SOLR-7127) Add method to CloudSolrClient to create per-collection clients

    [ https://issues.apache.org/jira/browse/SOLR-7127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14331980#comment-14331980 ] 

Shawn Heisey edited comment on SOLR-7127 at 2/22/15 1:33 AM:
-------------------------------------------------------------

bq. How about instead of returning a vanilla SolrClient, we return a CollectionSolrClient, which is an extension of CloudSolrClient with all the setters overridden to throw UnsupportedOperationException.

This sounds like a good idea.  Rather than complicate CloudSolrClient, use inheritance to wrangle whatever needs to behave differently into its own class, keeping the parent clean. Should the new class name include "Cloud"?  It is a cloud client, so maybe the name should reflect that.  I'm not going to be insistent on this ... the shorter name that you came up with is very good, I just thought I'd mention it for discussion.



was (Author: elyograg):
bq. How about instead of returning a vanilla SolrClient, we return a CollectionSolrClient, which is an extension of CloudSolrClient with all the setters overridden to throw UnsupportedOperationException.

This sounds like a good idea.  Rather than complicate CloudSolrClient, use inheritance to wrangle whatever needs to behave differently into its own class, keeping the parent clean. Should the new class name include "Cloud"?  It is a cloud client, so maybe the name should reflect that.


> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org