It sounds like the correspondent (Jonty) is thinking just in terms of SolrJ -- 
wanting to share that across multiple threads in an application server.

In which case the question would be whether it would be possible/safe/efficient 
to share a single instantiation of the SolrJ class(es) across multiple threads. 
 Of that I have insufficient knowledge, having not worked with SolrJ.

However, if instead the correspondent were to just connect directly to Solr via 
HTTP to a single, shared, Solr instance (without SolrJ) and manage the XML 
himself/herself, then there would not be a problem at all.

JRJ

-----Original Message-----
From: François Schiettecatte [mailto:fschietteca...@gmail.com] 
Sent: Friday, August 26, 2011 6:12 AM
To: solr-user@lucene.apache.org
Subject: Re: SolrServer instances

Sounds to me that you are looking for HTTP Persistent Connections (connection 
keep-alive as opposed to close), and a singleton object. This would be outside 
SOLR per se.

A few caveats though, I am not sure if tomcat supports keep-alive, and I am not 
sure how SOLR deals with multiple requests coming down the pipe, and you will 
need to deal with concurrency, and I am not sure what you are looking to gain 
from this, opening an http connection is pretty cheap.

François

On Aug 26, 2011, at 2:09 AM, Jonty Rhods wrote:

> do I also required to close the connection from solr server
> (CommonHttpSolrServer).
> 
> regards
> 
> On Fri, Aug 26, 2011 at 9:45 AM, Jonty Rhods <jonty.rh...@gmail.com> wrote:
> 
>> Deal all please help I am stuck here as I have not much experience..
>> 
>> thanks
>> 
>> On Thu, Aug 25, 2011 at 6:51 PM, Jonty Rhods <jonty.rh...@gmail.com>wrote:
>> 
>>> Hi All,
>>> 
>>> I am using SolrJ (3.1) and Tomcat 6.x. I want to open solr server once (20
>>> concurrence) and reuse this across all the site. Or something like
>>> connection pool like we are using for DB (ie Apache DBCP). There is a way to
>>> use static method which is a way but I want better solution from you people.
>>> 
>>> 
>>> 
>>> I read one threade where Ahmet suggest to use something like that
>>> 
>>> String serverPath = "http://localhost:8983/solr";;
>>> HttpClient client = new HttpClient(new
>>> MultiThreadedHttpConnectionManager());
>>> URL url = new URL(serverPath);
>>> CommonsHttpSolrServer solrServer = new CommonsHttpSolrServer(url, client);
>>> 
>>> But how to use instance of this across all class.
>>> 
>>> Please suggest.
>>> 
>>> regards
>>> Jonty
>>> 
>> 
>> 

Reply via email to