You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by th...@apache.org on 2016/07/16 21:32:57 UTC

[2/5] nutch git commit: Use static HttpClient for all SOLR connections

Use static HttpClient for all SOLR connections

Changed HttpClient to static based on http://hc.apache.org/httpclient-3.x/performance.html and added connection all SolrJ connections.

Project: http://git-wip-us.apache.org/repos/asf/nutch/repo
Commit: http://git-wip-us.apache.org/repos/asf/nutch/commit/6c1537b1
Tree: http://git-wip-us.apache.org/repos/asf/nutch/tree/6c1537b1
Diff: http://git-wip-us.apache.org/repos/asf/nutch/diff/6c1537b1

Branch: refs/heads/NUTCH-2292
Commit: 6c1537b16ba5f3e0fc28fff5a60595e01437900d
Parents: f64686b
Author: Steven <sj...@gmail.com>
Authored: Thu Jun 30 07:48:31 2016 -0400
Committer: GitHub <no...@github.com>
Committed: Thu Jun 30 07:48:31 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/nutch/indexwriter/solr/SolrUtils.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nutch/blob/6c1537b1/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrUtils.java
----------------------------------------------------------------------
diff --git a/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrUtils.java b/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrUtils.java
index 85a9c4c..d70bc62 100644
--- a/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrUtils.java
+++ b/src/plugin/indexer-solr/src/java/org/apache/nutch/indexwriter/solr/SolrUtils.java
@@ -32,6 +32,7 @@ import java.net.MalformedURLException;
 public class SolrUtils {
 
   public static Logger LOG = LoggerFactory.getLogger(SolrUtils.class);
+  private static HttpClient HTTP_CLIENT = new SystemDefaultHttpClient();
 
   /**
    *
@@ -52,7 +53,7 @@ public class SolrUtils {
       }
     } else {
       for (int i = 0; i < urls.length; i++) {
-        SolrClient sc = new HttpSolrClient(urls[i]);
+        SolrClient sc = new HttpSolrClient(urls[i], HTTP_CLIENT);
         solrClients.add(sc);
       }
     }
@@ -61,15 +62,14 @@ public class SolrUtils {
   }
 
   public static CloudSolrClient getCloudSolrClient(String url) throws MalformedURLException {
-    SystemDefaultHttpClient httpClient = new SystemDefaultHttpClient();
-    CloudSolrClient sc = new CloudSolrClient(url.replace('|', ','), httpClient);
+    CloudSolrClient sc = new CloudSolrClient(url.replace('|', ','), HTTP_CLIENT);
     sc.setParallelUpdates(true);
     sc.connect();
     return sc;
   }
 
   public static SolrClient getHttpSolrClient(String url) throws MalformedURLException {
-    SolrClient sc =new HttpSolrClient(url);
+    SolrClient sc =new HttpSolrClient(url, HTTP_CLIENT);
     return sc;
   }