You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Jan Høydahl <ja...@cominvent.com> on 2019/02/21 10:16:44 UTC

HttpClusterStateProvider connects in constructor instead of in connect()

Hi,

I was surprised that the HttpClusterStateProvider starts connecting to Solr already
in the constructor and not when cluster state is first requested, using the connect() method.
The connect() method from ClusterStateProvider interface is implemented with an empty body.

Risking that the constructor throws an exception e.g. due to timing issues makes it harder
to implement graceful handling of connectivity issues. If the constructor would just initialize
the urls, then you could separate connection retry issue handling in other parts of client code.

If you agree, I'll open an issue to change this.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: HttpClusterStateProvider connects in constructor instead of in connect()

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Yes, thanks Jan. Another problem I found with it was that it does not
support basic auth. I can open a separate issue about that.

On Thu, Feb 21, 2019 at 4:46 AM Ishan Chattopadhyaya <
ichattopadhyaya@gmail.com> wrote:

> +1, please open an issue. Seems like an oversight/bug.
>
> On Thu, Feb 21, 2019 at 3:46 PM Jan Høydahl <ja...@cominvent.com> wrote:
>
>> Hi,
>>
>> I was surprised that the HttpClusterStateProvider starts connecting to
>> Solr already
>> in the constructor and not when cluster state is first requested, using
>> the connect() method.
>> The connect() method from ClusterStateProvider interface is implemented
>> with an empty body.
>>
>> Risking that the constructor throws an exception e.g. due to timing
>> issues makes it harder
>> to implement graceful handling of connectivity issues. If the constructor
>> would just initialize
>> the urls, then you could separate connection retry issue handling in
>> other parts of client code.
>>
>> If you agree, I'll open an issue to change this.
>>
>> --
>> Jan Høydahl, search solution architect
>> Cominvent AS - www.cominvent.com
>>
>>

-- 
Regards,
Shalin Shekhar Mangar.

Re: HttpClusterStateProvider connects in constructor instead of in connect()

Posted by Ishan Chattopadhyaya <ic...@gmail.com>.
+1, please open an issue. Seems like an oversight/bug.

On Thu, Feb 21, 2019 at 3:46 PM Jan Høydahl <ja...@cominvent.com> wrote:

> Hi,
>
> I was surprised that the HttpClusterStateProvider starts connecting to
> Solr already
> in the constructor and not when cluster state is first requested, using
> the connect() method.
> The connect() method from ClusterStateProvider interface is implemented
> with an empty body.
>
> Risking that the constructor throws an exception e.g. due to timing issues
> makes it harder
> to implement graceful handling of connectivity issues. If the constructor
> would just initialize
> the urls, then you could separate connection retry issue handling in other
> parts of client code.
>
> If you agree, I'll open an issue to change this.
>
> --
> Jan Høydahl, search solution architect
> Cominvent AS - www.cominvent.com
>
>