You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/12/20 13:07:24 UTC
svn commit: r1221215 - in /incubator/lcf/integration/solr-3.x/trunk:
CHANGES.txt build.xml
mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
Author: kwright
Date: Tue Dec 20 12:07:23 2011
New Revision: 1221215
URL: http://svn.apache.org/viewvc?rev=1221215&view=rev
Log:
Partial fix for CONNECTORS-333. Use MultiThreadedHttpConnectionManager to pool connections.
Modified:
incubator/lcf/integration/solr-3.x/trunk/CHANGES.txt
incubator/lcf/integration/solr-3.x/trunk/build.xml
incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
Modified: incubator/lcf/integration/solr-3.x/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/integration/solr-3.x/trunk/CHANGES.txt?rev=1221215&r1=1221214&r2=1221215&view=diff
==============================================================================
--- incubator/lcf/integration/solr-3.x/trunk/CHANGES.txt (original)
+++ incubator/lcf/integration/solr-3.x/trunk/CHANGES.txt Tue Dec 20 12:07:23 2011
@@ -1,7 +1,13 @@
Apache ManifoldCF Solr 3.x Plugin change Log
$Id$
-======================= 0.1-dev =====================
+======================= 0.2-incubating-dev =====================
+
+CONNECTORS-333: Use multithreaded connection manager and tcp-no-delay
+in order to avoid sockets accumulating in CLOSE_WAIT.
+(Simon Willnauer via Karl Wright)
+
+======================= Release 0.1 =====================
Initial commit.
(Karl Wright)
Modified: incubator/lcf/integration/solr-3.x/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/integration/solr-3.x/trunk/build.xml?rev=1221215&r1=1221214&r2=1221215&view=diff
==============================================================================
--- incubator/lcf/integration/solr-3.x/trunk/build.xml (original)
+++ incubator/lcf/integration/solr-3.x/trunk/build.xml Tue Dec 20 12:07:23 2011
@@ -63,7 +63,7 @@
<target name="build" depends="deliver"/>
<target name="set-version">
- <property name="release-version" value="0.1-incubating"/>
+ <property name="release-version" value="0.2-incubating-dev"/>
</target>
<target name="create-source-zip" depends="set-version">
Modified: incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
URL: http://svn.apache.org/viewvc/incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java?rev=1221215&r1=1221214&r2=1221215&view=diff
==============================================================================
--- incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java (original)
+++ incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java Tue Dec 20 12:07:23 2011
@@ -36,6 +36,7 @@ import org.apache.solr.handler.component
import org.apache.solr.handler.component.SearchComponent;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
+import org.apache.commons.httpclient.params.*;
import org.slf4j.*;
import java.io.*;
@@ -72,10 +73,26 @@ public class ManifoldCFQParserPlugin ext
String fieldAllowShare = null;
String fieldDenyShare = null;
int socketTimeOut;
+ MultiThreadedHttpConnectionManager httpConnectionManager;
+ HttpClient client;
public ManifoldCFQParserPlugin()
{
super();
+ HttpConnectionManagerParams params = new HttpConnectionManagerParams();
+ params.setTcpNoDelay(true);
+ params.setStaleCheckingEnabled(false);
+ httpConnectionManager = new MultiThreadedHttpConnectionManager();
+ httpConnectionManager.setParams(params);
+ client = new HttpClient(httpConnectionManager);
+ }
+
+ @Override
+ protected void finalize()
+ throws Throwable
+ {
+ super.finalize();
+ httpConnectionManager.shutdown();
}
public void init(NamedList args)
@@ -226,7 +243,6 @@ public class ManifoldCFQParserPlugin ext
throws IOException
{
// We can make this more complicated later, with support for https etc., but this is enough to demonstrate how it all should work.
- HttpClient client = new HttpClient();
String theURL = authorityBaseURL + "/UserACLs?username="+URLEncoder.encode(authenticatedUserName,"utf-8");
GetMethod method = new GetMethod(theURL);
@@ -243,7 +259,7 @@ public class ManifoldCFQParserPlugin ext
InputStream is = method.getResponseBodyAsStream();
try
{
- Reader r = new InputStreamReader(is,"utf-8");
+ Reader r = new InputStreamReader(is,method.getResponseCharSet());
try
{
BufferedReader br = new BufferedReader(r);
Modified: incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
URL: http://svn.apache.org/viewvc/incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java?rev=1221215&r1=1221214&r2=1221215&view=diff
==============================================================================
--- incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java (original)
+++ incubator/lcf/integration/solr-3.x/trunk/mcf/src/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java Tue Dec 20 12:07:23 2011
@@ -27,6 +27,7 @@ import org.apache.solr.handler.component
import org.apache.solr.handler.component.SearchComponent;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
+import org.apache.commons.httpclient.params.*;
import org.slf4j.*;
import java.io.*;
@@ -64,13 +65,29 @@ public class ManifoldCFSearchComponent e
String fieldAllowShare = null;
String fieldDenyShare = null;
int socketTimeOut;
+ MultiThreadedHttpConnectionManager httpConnectionManager;
+ HttpClient client;
public ManifoldCFSearchComponent()
{
super();
+ HttpConnectionManagerParams params = new HttpConnectionManagerParams();
+ params.setTcpNoDelay(true);
+ params.setStaleCheckingEnabled(false);
+ httpConnectionManager = new MultiThreadedHttpConnectionManager();
+ httpConnectionManager.setParams(params);
+ client = new HttpClient(httpConnectionManager);
}
@Override
+ protected void finalize()
+ throws Throwable
+ {
+ super.finalize();
+ httpConnectionManager.shutdown();
+ }
+
+ @Override
public void init(NamedList args)
{
super.init(args);
@@ -253,7 +270,6 @@ public class ManifoldCFSearchComponent e
throws IOException
{
// We can make this more complicated later, with support for https etc., but this is enough to demonstrate how it all should work.
- HttpClient client = new HttpClient();
String theURL = authorityBaseURL + "/UserACLs?username="+URLEncoder.encode(authenticatedUserName,"utf-8");
GetMethod method = new GetMethod(theURL);
@@ -270,7 +286,7 @@ public class ManifoldCFSearchComponent e
InputStream is = method.getResponseBodyAsStream();
try
{
- Reader r = new InputStreamReader(is,"utf-8");
+ Reader r = new InputStreamReader(is,method.getResponseCharSet());
try
{
BufferedReader br = new BufferedReader(r);