lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: solr shutdown error
Date Sat, 02 Jul 2016 06:22:49 GMT
On 7/1/2016 10:59 PM, Kent Mu wrote:
> solr version: 4.9.0 I create and get a HttpSolrServer connection by
> singleton pattern. I find the method of "shutdown" in solrj API, so I
> decided to use "shutdown" to release resources, but I got the error as
> below, It is due to singleton pattern? 

If you call shutdown, that client object can no longer be used.  You
will need to make a new one.

The expected usage pattern for the client object is that you will create
one object when the program starts and use it for all threads until the
program exits.  Whether or not to use the singleton pattern for that is
up to you.  Usually the only time you would call shutdown is just before
program exit ... but if the program is exiting, shutdown isn't really
necessary.

If you are in a situation where client objects are being regularly
created, then you would want to do shutdown on each of them when you are
finished so you don't have a resource leak.  Creating many client
objects is not recommended.

Thanks,
Shawn


Mime
View raw message