lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Gerlowski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-8097) Implement a builder pattern for constructing a Solrj client
Date Wed, 06 Apr 2016 15:10:26 GMT

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

Jason Gerlowski commented on SOLR-8097:
---------------------------------------

So, I've got an updated patch that does everything except the renaming.  I'm fine w/ shortening
the names of the static *Builder classes, but when I went to do that, I ran into a bunch of
compilation issues related to "ambiguous references" or "type mismatch".

The root of the problem appears to be name conflicts, most of which are with HttpClient's
{{Builder}} class.  As an example, look at this snippet of code:

{code}
          Builder requestConfigBuilder = HttpClientUtil.createDefaultRequestConfigBuilder();
          if (soTimeout != null) {
            requestConfigBuilder.setSocketTimeout(soTimeout);
          }
          if (connectionTimeout != null) {
            requestConfigBuilder.setConnectTimeout(connectionTimeout);
          }
{code}

This will fail to compile with the message: "Type mismatch: Cannot convert from RequestConfig.Builder
to ConcurrentUpdateSolrClient.Builder".  This is easily fixable by changing all {{Builder}}
references to be unambiguous (RequestConfig.Builder or ConcurrentUpdateSolrClient.Builder).
 I'm happy to do that, if this is what we want, but I'm reluctant to let this patch get much
bigger than it already is.

That said, I'm happy to pull the trigger if we're sure this is what we want.  If anyone else
sees a better way around this that I'm missing, please let me know.

> 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: master
>            Reporter: Hrishikesh Gadre
>            Assignee: Anshum Gupta
>            Priority: Minor
>         Attachments: SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch,
SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch, SOLR-8097.patch,
SOLR-8097.patch, 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