Permalink
Browse files

14607: SolrJ client - Ensure Solr's HTTP connections are persistent

Provided means to disable "Connection: Keep-Alive" as requested.
  • Loading branch information...
1 parent 486cccc commit 2f65e1dce793305752707d49a114697bbd08db53 @kirktrue kirktrue committed Mar 20, 2013
Showing with 11 additions and 1 deletion.
  1. +1 −1 pom.xml
  2. +10 −0 src/main/java/com/mustardgrain/solr/SolrClient.java
View
@@ -4,7 +4,7 @@
<groupId>com.mustardgrain.solr</groupId>
<artifactId>solrj-ex</artifactId>
<packaging>jar</packaging>
- <version>1.0-alpha2</version>
+ <version>1.0-alpha3</version>
<name>SolrJ client based off of LBHttpSolrServer</name>
<dependencies>
<dependency>
@@ -337,6 +337,16 @@ public void process(HttpRequest request, HttpContext context) throws HttpExcepti
});
}
+ public void disableConnectonHeader() {
+ ((AbstractHttpClient) httpClient).addRequestInterceptor(new HttpRequestInterceptor() {
+
+ @Override
+ public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
+ request.removeHeaders("Connection");
+ }
+ });
+ }
+
/**
* Tries to query a live server from the list provided in Req. Servers in
* the dead pool are skipped. If a request fails due to an IOException, the

0 comments on commit 2f65e1d

Please sign in to comment.