lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent Mu <>
Subject Re: solr shutdown error
Date Sat, 02 Jul 2016 08:26:41 GMT
Thanks for your reply!

I do understand your explaination, but another question accurs, When I
create CloudSolrServer Connection by singleton pattern like this, and I
call shutdown, but it's OK. the solr version is 4.9.0. that's why?

    public synchronized static CloudSolrServer getSolrCloudReadServer() {
        if (reviewSolrCloudServer == null) {
        ModifiableSolrParams params = new ModifiableSolrParams();
        params.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 10000);
        params.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 500);
        HttpClient client = HttpClientUtil.createClient(params);
        LBHttpSolrServer lbServer = new LBHttpSolrServer(client);


        reviewSolrCloudServer = new


        return reviewSolrCloudServer;

2016-07-02 14:22 GMT+08:00 Shawn Heisey <>:

> 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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message