lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r890769 - in /lucene/solr/trunk: CHANGES.txt src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
Date Tue, 15 Dec 2009 11:32:27 GMT
Author: shalin
Date: Tue Dec 15 11:32:27 2009
New Revision: 890769

URL: http://svn.apache.org/viewvc?rev=890769&view=rev
Log:
SOLR-1532 -- Allow StreamingUpdateSolrServer to use a provided HttpClient

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=890769&r1=890768&r2=890769&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Dec 15 11:32:27 2009
@@ -67,6 +67,8 @@
 
 * SOLR-1621: Allow current single core deployments to be specified by solr.xml (Mark Miller
, noble)
 
+* SOLR-1532: Allow StreamingUpdateSolrServer to use a provided HttpClient (Gabriele Renzi
via shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java?rev=890769&r1=890768&r2=890769&view=diff
==============================================================================
--- lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
(original)
+++ lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
Tue Dec 15 11:32:27 2009
@@ -27,6 +27,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
@@ -61,10 +62,26 @@
   final Queue<Runner> runners;
   volatile CountDownLatch lock = null;  // used to block everything
   final int threadCount;
-  
-  public StreamingUpdateSolrServer(String solrServerUrl, int queueSize, int threadCount )
throws MalformedURLException  {
-    super( solrServerUrl );
-    queue = new LinkedBlockingQueue<UpdateRequest>( queueSize );
+
+  /**
+   * Uses an internal MultiThreadedHttpConnectionManager to manage http connections
+   *
+   * @param solrServerUrl The solr server url
+   * @param queueSize     The buffer size before the documents are sent o the server
+   * @param threadCount   The number of backgtound threads used to empty the queue
+   * @throws MalformedURLException
+   */
+  public StreamingUpdateSolrServer(String solrServerUrl, int queueSize, int threadCount)
throws MalformedURLException {
+    this(solrServerUrl, null, queueSize, threadCount);
+  }
+
+  /**
+   * Uses the supplied HttpClient to send documents to the solr server, the HttpClient should
be instantiated using a
+   * MultiThreadedHttpConnectionManager.
+   */
+  public StreamingUpdateSolrServer(String solrServerUrl, HttpClient client, int queueSize,
int threadCount) throws MalformedURLException {
+    super(solrServerUrl, client);
+    queue = new LinkedBlockingQueue<UpdateRequest>(queueSize);
     this.threadCount = threadCount;
     runners = new LinkedList<Runner>();
   }



Mime
View raw message