lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn Heisey (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-8097) Implement a builder pattern for constructing a Solrj client
Date Mon, 08 Feb 2016 19:02:39 GMT

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

Shawn Heisey commented on SOLR-8097:
------------------------------------

I like the idea of going with a builder pattern.

I would probably start with initial work on HttpSolrClient, work out the kinks there, then
do the Concurrent and LB objects, and tackle Cloud last.  I would do it this way so that each
class can utilize methods from the "lower" class.  I don't know if it makes sense to create
a "SolrClientBuilder" interface or abstract class, but that can be investigated.

If the embedded server needs similar treatment, then we should see whether it makes any sense
to incorporate changes into the parent class -- SolrClient.  A builder pattern for the embedded
server probably does make sense, but I haven't looked deeper to verify.

To delay the impact to client programs as long as possible, we should skip branch_5x, and
just make the change in the master branch.  The old constructors can be removed in master
once branch_6x is created.


> Implement a builder pattern for constructing a Solrj client
> -----------------------------------------------------------
>
>                 Key: SOLR-8097
>                 URL: https://issues.apache.org/jira/browse/SOLR-8097
>             Project: Solr
>          Issue Type: Improvement
>          Components: SolrJ
>    Affects Versions: Trunk
>            Reporter: Hrishikesh Gadre
>            Priority: Minor
>         Attachments: SOLR-8097.patch
>
>
> Currently Solrj clients (e.g. CloudSolrClient) supports multiple constructors as follows,
> public CloudSolrClient(String zkHost) 
> public CloudSolrClient(String zkHost, HttpClient httpClient) 
> public CloudSolrClient(Collection<String> zkHosts, String chroot)
> public CloudSolrClient(Collection<String> zkHosts, String chroot, HttpClient httpClient)
> public CloudSolrClient(String zkHost, boolean updatesToLeaders)
> public CloudSolrClient(String zkHost, boolean updatesToLeaders, HttpClient httpClient)
> It is kind of problematic while introducing an additional parameters (since we need to
introduce additional constructors). Instead it will be helpful to provide SolrClient Builder
which can provide either default values or support overriding specific parameter. 



--
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


Mime
View raw message