mirror of https://github.com/apache/lucene.git
SOLR-8433: Change how HttpClient is initialized in attempt to eliminate test failures
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1723397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
71a18c4ddc
commit
9f7f89fc97
|
@ -48,15 +48,6 @@ public abstract class IterativeMergeStrategy implements MergeStrategy {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||||
|
|
||||||
|
|
||||||
static {
|
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
|
||||||
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 128);
|
|
||||||
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 32);
|
|
||||||
HttpClientConfigurer configurer = HttpClientUtil.getConfigurer();
|
|
||||||
httpClient = HttpClientUtil.createClient(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void merge(ResponseBuilder rb, ShardRequest sreq) {
|
public void merge(ResponseBuilder rb, ShardRequest sreq) {
|
||||||
rb._responseDocs = new SolrDocumentList(); // Null pointers will occur otherwise.
|
rb._responseDocs = new SolrDocumentList(); // Null pointers will occur otherwise.
|
||||||
rb.onePassDistributedQuery = true; // Turn off the second pass distributed.
|
rb.onePassDistributedQuery = true; // Turn off the second pass distributed.
|
||||||
|
@ -94,16 +85,7 @@ public abstract class IterativeMergeStrategy implements MergeStrategy {
|
||||||
|
|
||||||
public CallBack(ShardResponse originalShardResponse, QueryRequest req) {
|
public CallBack(ShardResponse originalShardResponse, QueryRequest req) {
|
||||||
|
|
||||||
log.info("############### HttpClientConfigurer ##################:" + HttpClientUtil.getConfigurer().getClass());
|
this.solrClient = new HttpSolrClient(originalShardResponse.getShardAddress(), getHttpClient());
|
||||||
|
|
||||||
log.info("################ SHARD ADDRESSS ##############:" + originalShardResponse.getShardAddress());
|
|
||||||
log.info("############ HTTP Client #############:"+ httpClient.getClass());
|
|
||||||
List<String> schemes = httpClient.getConnectionManager().getSchemeRegistry().getSchemeNames();
|
|
||||||
for(String scheme : schemes) {
|
|
||||||
log.info("############ Scheme #############:"+ scheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.solrClient = new HttpSolrClient(originalShardResponse.getShardAddress(), httpClient);
|
|
||||||
this.req = req;
|
this.req = req;
|
||||||
this.originalShardResponse = originalShardResponse;
|
this.originalShardResponse = originalShardResponse;
|
||||||
req.setMethod(SolrRequest.METHOD.POST);
|
req.setMethod(SolrRequest.METHOD.POST);
|
||||||
|
@ -139,4 +121,16 @@ public abstract class IterativeMergeStrategy implements MergeStrategy {
|
||||||
|
|
||||||
protected abstract void process(ResponseBuilder rb, ShardRequest sreq) throws Exception;
|
protected abstract void process(ResponseBuilder rb, ShardRequest sreq) throws Exception;
|
||||||
|
|
||||||
|
static synchronized HttpClient getHttpClient() {
|
||||||
|
|
||||||
|
if(httpClient == null) {
|
||||||
|
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||||
|
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 128);
|
||||||
|
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 32);
|
||||||
|
httpClient = HttpClientUtil.createClient(params);
|
||||||
|
return httpClient;
|
||||||
|
} else {
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue