Hey Steven,

I'd also recommend watching Jason Gerlowski's excellent talk at Activate a few 
years ago he walks through SolrJ, some best practices, different types of 
clients, and common mistakes.  This should be a good starting point for using 
SolrJ along with the official docs which have some code examples 
https://solr.apache.org/guide/8_11/using-solrj.html

https://www.youtube.com/watch?v=ACPUR_GL5zM.

Thanks,

Dwane
________________________________
From: Vincenzo D'Amore <[email protected]>
Sent: Saturday, 5 February 2022 9:57 PM
To: [email protected] <[email protected]>
Cc: solr-user <[email protected]>
Subject: Re: Memory and thread leak using SolrJ

Just create all the clients you need and reuse them all along.
By the way in the documentation should be written somewhere what’s the best 
practices for the Solr clients usages.

Ciao,
Vincenzo

--
mobile: 3498513251
skype: free.dev

> On 5 Feb 2022, at 11:55, Vincenzo D'Amore <[email protected]> wrote:
>
> 
>>
>> SolrClient Are singletons and are thread safe
> You should reuse them
>
> --
> mobile: 3498513251
> skype: free.dev
>
>> On 5 Feb 2022, at 02:49, Steven White <[email protected]> wrote:
>>
>> Hi everyone,
>>
>> This simple code, is causing me memory and thread loak (threads remain in
>> "sleeping" mode):
>>
>>   for (int j = 0; j < 10000; j++)
>>   {
>>       SolrClient solrClient = new
>> HttpSolrClient.Builder("foo-bar").build();
>>   }
>>
>> Any idea why?  Is there an unbuild(), release() or something I have to call?
>>
>> I'm on Solr 8.11.1
>>
>> Thanks
>>
>> Steven

Reply via email to