SOLR-8595: Use BinaryRequestWriter by default in HttpSolrClient and ConcurrentUpdateSolrClient

This commit is contained in:
Shalin Shekhar Mangar 2016-01-27 20:50:54 +05:30
parent cd82417c35
commit 6acfa2a4ff
4 changed files with 7 additions and 5 deletions

View File

@ -570,6 +570,8 @@ Other Changes
* SOLR-8565: add & use CommonParams.(ROWS|START)_DEFAULT constants (Christine Poerschke) * SOLR-8565: add & use CommonParams.(ROWS|START)_DEFAULT constants (Christine Poerschke)
* SOLR-8595: Use BinaryRequestWriter by default in HttpSolrClient and ConcurrentUpdateSolrClient. (shalin)
================== 5.4.1 ================== ================== 5.4.1 ==================
Bug Fixes Bug Fixes

View File

@ -140,7 +140,7 @@ public class HttpSolrClient extends SolrClient {
* *
* @see org.apache.solr.client.solrj.request.RequestWriter * @see org.apache.solr.client.solrj.request.RequestWriter
*/ */
protected volatile RequestWriter requestWriter = new RequestWriter(); protected volatile RequestWriter requestWriter = new BinaryRequestWriter();
private final HttpClient httpClient; private final HttpClient httpClient;

View File

@ -62,6 +62,7 @@ import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettyConfig; import org.apache.solr.client.solrj.embedded.JettyConfig;
import org.apache.solr.client.solrj.request.QueryRequest; import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.RequestWriter;
import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
@ -452,13 +453,14 @@ public class BasicHttpSolrClientTest extends SolrJettyTestBase {
assertEquals(1, DebugServlet.parameters.get(CommonParams.VERSION).length); assertEquals(1, DebugServlet.parameters.get(CommonParams.VERSION).length);
assertEquals(client.getParser().getVersion(), DebugServlet.parameters.get(CommonParams.VERSION)[0]); assertEquals(client.getParser().getVersion(), DebugServlet.parameters.get(CommonParams.VERSION)[0]);
//content type //content type
assertEquals("application/xml; charset=UTF-8", DebugServlet.headers.get("Content-Type")); assertEquals("application/javabin", DebugServlet.headers.get("Content-Type"));
//parameter encoding //parameter encoding
assertEquals(1, DebugServlet.parameters.get("a").length); assertEquals(1, DebugServlet.parameters.get("a").length);
assertEquals("\u1234", DebugServlet.parameters.get("a")[0]); assertEquals("\u1234", DebugServlet.parameters.get("a")[0]);
//XML response //XML response and writer
client.setParser(new XMLResponseParser()); client.setParser(new XMLResponseParser());
client.setRequestWriter(new RequestWriter());
try { try {
client.request(req); client.request(req);
} catch (ParseException ignored) {} } catch (ParseException ignored) {}

View File

@ -160,8 +160,6 @@ public class ConcurrentUpdateSolrClientTest extends SolrJettyTestBase {
} }
}; };
concurrentClient.setParser(new BinaryResponseParser());
concurrentClient.setRequestWriter(new BinaryRequestWriter());
concurrentClient.setPollQueueTime(0); concurrentClient.setPollQueueTime(0);
// ensure it doesn't block where there's nothing to do yet // ensure it doesn't block where there's nothing to do yet