incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1245127 - in /incubator/lcf/trunk: CHANGES.txt connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java
Date Thu, 16 Feb 2012 19:17:22 GMT
Author: kwright
Date: Thu Feb 16 19:17:22 2012
New Revision: 1245127

URL: http://svn.apache.org/viewvc?rev=1245127&view=rev
Log:
Fix for CONNECTORS-406.  Add MultiThreadedHttpConnectionManager usage to OpenSearchServer
connector.

Modified:
    incubator/lcf/trunk/CHANGES.txt
    incubator/lcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java

Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1245127&r1=1245126&r2=1245127&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Thu Feb 16 19:17:22 2012
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 0.5-dev =====================
 
+CONNECTORS-406: Use MultiThreadedHttpConnection manager in script
+engine and in OpenSearchServer connector.
+(Luca Stancapiano, Karl Wright)
+
 CONNECTORS-409: Set mcf-ui-core.jar to all the examples lib.
 (Shinichiro Abe)
 

Modified: incubator/lcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java?rev=1245127&r1=1245126&r2=1245127&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java
(original)
+++ incubator/lcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnection.java
Thu Feb 16 19:17:22 2012
@@ -33,6 +33,7 @@ import javax.xml.xpath.XPathFactory;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
 import org.apache.commons.io.IOUtils;
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.w3c.dom.Document;
@@ -57,6 +58,10 @@ public class OpenSearchServerConnection 
 
   private Document xmlResponse;
 
+  private MultiThreadedHttpConnectionManager connectionManager;
+  
+  private HttpClient httpClient;
+  
   protected String xPathStatus = "/response/entry[@key='Status']/text()";
   protected String xPathException = "/response/entry[@key='Exception']/text()";
 
@@ -76,6 +81,15 @@ public class OpenSearchServerConnection 
     indexName = config.getIndexName();
     userName = config.getUserName();
     apiKey = config.getApiKey();
+    connectionManager = new MultiThreadedHttpConnectionManager();
+    // I don't know where CommonsHTTPClientPropertiesFactory.create() gets its parameters,
but it was too small
+    // by default.  Since we control
+    // the pool sizes at a higher level, these should be pretty much wide open at this level
+    //cm.getParams().setDefaultMaxConnectionsPerHost(clientProperties.getMaximumConnectionsPerHost());
+    //cm.getParams().setMaxTotalConnections(clientProperties.getMaximumTotalConnections());
+    connectionManager.getParams().setDefaultMaxConnectionsPerHost(1000);
+    connectionManager.getParams().setMaxTotalConnections(1000);
+    httpClient = new HttpClient(connectionManager);
   }
 
   protected final String urlEncode(String t) throws ManifoldCFException {
@@ -105,7 +119,7 @@ public class OpenSearchServerConnection 
   }
 
   protected void call(HttpMethod method) throws ManifoldCFException {
-    HttpClient hc = new HttpClient();
+    HttpClient hc = httpClient;
     try {
       hc.executeMethod(method);
       if (!checkResultCode(method.getStatusCode()))



Mime
View raw message