SolrClient implements Closable which means it needs to be closed when
you're done with it or you leak resources.

On Thu, Feb 17, 2022 at 6:47 PM Steven White <[email protected]> wrote:
>
> Hi everyone,
>
> I wanted to follow up on this topic, thank everyone for your feedback and
> share with you what fixed my issue in case anyone else runs into it.
> Rather than reply to each feedback, I figured it is best to summarize it
> here.
>
> The code I'm dealing with is a legacy that I inherited.  Thus, it is out of
> the question to refactor to have a pool of SolrClient to reuse.  The fix
> was adding a call to solrClient.close().  I don't know Solr code to
> conclude if this is a defect or not.  But from an API user perspective, I
> shouldn't have to call close() unless it is documented that I must when I'm
> done with the object.  I will leave it to those who know Solr to decide if
> this is a defect or not.
>
> Thank you all again for your help on this topic.
>
> Steven
>
>
> On Fri, Feb 4, 2022 at 8:49 PM 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