You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Paul Smith Parker <pa...@gmail.com> on 2017/08/13 09:43:23 UTC

ConcurrentUpdateSolrClient example?

Hello,

I can’t find an example on how to properly instantiate/configure an instance of ConcurrentUpdateSolrClient.

I tried this but it gives me a NPE: 

ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core").build();

While this seems to work (it should use an internal httpClient):
ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core")
				.withHttpClient(null)
				.withQueueSize(1000)
				.withThreadCount(20)
				.build();

Is this the correct way to set it up?

Thanks,
P.

Re: ConcurrentUpdateSolrClient example?

Posted by Jason Gerlowski <ge...@gmail.com>.
Created SOLR-11256 for giving "queueSize" a default.  There's a patch
attached on that JIRA with 10 as the chosen default.  Whether that
particular value sticks or not, at least there's a fix in the works!

On Mon, Aug 14, 2017 at 9:36 AM, Jason Gerlowski <ge...@gmail.com> wrote:
> Ah, glad you figured it out.  And thanks for the clarification.  That
> does look like something that could/should be improved though.
> QueueSize could be given a reasonable (and documented) default, to
> save people from the IAE.  I'll take a look this afternoon and create
> a JIRA if there's not a rationale behind this (which there might be).
>
> On Mon, Aug 14, 2017 at 2:23 AM, Paul Smith Parker
> <pa...@gmail.com> wrote:
>> Hello Jason,
>>
>> I figured it out:
>>
>> 1) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core").build();
>> 2) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core")
>>                                 .withQueueSize(20)
>>                                 .build();
>>
>> 1) fails with an IllegalArgumentException due to the fact the the queue size is not specified.
>> 2) works as expected.
>>
>> Cheers,
>> P.
>>
>>> On 13 Aug 2017, at 22:58, Jason Gerlowski <ge...@gmail.com> wrote:
>>>
>>> Hi Paul,
>>>
>>> I'll try reproducing this with the snippet provided, but I don't see
>>> anything inherently wrong with the Builder usage you mentioned, assuming
>>> the Solr base URL you provided is correct.
>>>
>>> It would be easier to troubleshoot your issue though if you included some
>>> more information about the NPE you're seeing. Could you post the stacktrace
>>> to help others investigate please?
>>>
>>> Best,
>>>
>>> Jason
>>>
>>> On Aug 13, 2017 5:43 AM, "Paul Smith Parker" <pa...@gmail.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I can’t find an example on how to properly instantiate/configure an
>>>> instance of ConcurrentUpdateSolrClient.
>>>>
>>>> I tried this but it gives me a NPE:
>>>>
>>>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>>>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/
>>>> core").build();
>>>>
>>>> While this seems to work (it should use an internal httpClient):
>>>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>>>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core")
>>>>                                .withHttpClient(null)
>>>>                                .withQueueSize(1000)
>>>>                                .withThreadCount(20)
>>>>                                .build();
>>>>
>>>> Is this the correct way to set it up?
>>>>
>>>> Thanks,
>>>> P.
>>

Re: ConcurrentUpdateSolrClient example?

Posted by Jason Gerlowski <ge...@gmail.com>.
Ah, glad you figured it out.  And thanks for the clarification.  That
does look like something that could/should be improved though.
QueueSize could be given a reasonable (and documented) default, to
save people from the IAE.  I'll take a look this afternoon and create
a JIRA if there's not a rationale behind this (which there might be).

On Mon, Aug 14, 2017 at 2:23 AM, Paul Smith Parker
<pa...@gmail.com> wrote:
> Hello Jason,
>
> I figured it out:
>
> 1) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core").build();
> 2) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core")
>                                 .withQueueSize(20)
>                                 .build();
>
> 1) fails with an IllegalArgumentException due to the fact the the queue size is not specified.
> 2) works as expected.
>
> Cheers,
> P.
>
>> On 13 Aug 2017, at 22:58, Jason Gerlowski <ge...@gmail.com> wrote:
>>
>> Hi Paul,
>>
>> I'll try reproducing this with the snippet provided, but I don't see
>> anything inherently wrong with the Builder usage you mentioned, assuming
>> the Solr base URL you provided is correct.
>>
>> It would be easier to troubleshoot your issue though if you included some
>> more information about the NPE you're seeing. Could you post the stacktrace
>> to help others investigate please?
>>
>> Best,
>>
>> Jason
>>
>> On Aug 13, 2017 5:43 AM, "Paul Smith Parker" <pa...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> I can’t find an example on how to properly instantiate/configure an
>>> instance of ConcurrentUpdateSolrClient.
>>>
>>> I tried this but it gives me a NPE:
>>>
>>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/
>>> core").build();
>>>
>>> While this seems to work (it should use an internal httpClient):
>>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core")
>>>                                .withHttpClient(null)
>>>                                .withQueueSize(1000)
>>>                                .withThreadCount(20)
>>>                                .build();
>>>
>>> Is this the correct way to set it up?
>>>
>>> Thanks,
>>> P.
>

Re: ConcurrentUpdateSolrClient example?

Posted by Paul Smith Parker <pa...@gmail.com>.
Hello Jason,

I figured it out:

1) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core").build();
2) ConcurrentUpdateSolrClient build = new ConcurrentUpdateSolrClient.Builder("http://localhost:8389/solr/core")
				.withQueueSize(20)
				.build();

1) fails with an IllegalArgumentException due to the fact the the queue size is not specified.
2) works as expected.

Cheers,
P.

> On 13 Aug 2017, at 22:58, Jason Gerlowski <ge...@gmail.com> wrote:
> 
> Hi Paul,
> 
> I'll try reproducing this with the snippet provided, but I don't see
> anything inherently wrong with the Builder usage you mentioned, assuming
> the Solr base URL you provided is correct.
> 
> It would be easier to troubleshoot your issue though if you included some
> more information about the NPE you're seeing. Could you post the stacktrace
> to help others investigate please?
> 
> Best,
> 
> Jason
> 
> On Aug 13, 2017 5:43 AM, "Paul Smith Parker" <pa...@gmail.com>
> wrote:
> 
>> Hello,
>> 
>> I can’t find an example on how to properly instantiate/configure an
>> instance of ConcurrentUpdateSolrClient.
>> 
>> I tried this but it gives me a NPE:
>> 
>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/
>> core").build();
>> 
>> While this seems to work (it should use an internal httpClient):
>> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
>> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core")
>>                                .withHttpClient(null)
>>                                .withQueueSize(1000)
>>                                .withThreadCount(20)
>>                                .build();
>> 
>> Is this the correct way to set it up?
>> 
>> Thanks,
>> P.


Re: ConcurrentUpdateSolrClient example?

Posted by Jason Gerlowski <ge...@gmail.com>.
Hi Paul,

I'll try reproducing this with the snippet provided, but I don't see
anything inherently wrong with the Builder usage you mentioned, assuming
the Solr base URL you provided is correct.

It would be easier to troubleshoot your issue though if you included some
more information about the NPE you're seeing. Could you post the stacktrace
to help others investigate please?

Best,

Jason

On Aug 13, 2017 5:43 AM, "Paul Smith Parker" <pa...@gmail.com>
wrote:

> Hello,
>
> I can’t find an example on how to properly instantiate/configure an
> instance of ConcurrentUpdateSolrClient.
>
> I tried this but it gives me a NPE:
>
> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/
> core").build();
>
> While this seems to work (it should use an internal httpClient):
> ConcurrentUpdateSolrClient solrClient = new ConcurrentUpdateSolrClient.
> Builder(“http://localhost:8389/solr <http://localhost:8389/solr>/core")
>                                 .withHttpClient(null)
>                                 .withQueueSize(1000)
>                                 .withThreadCount(20)
>                                 .build();
>
> Is this the correct way to set it up?
>
> Thanks,
> P.