public class HttpShardHandlerFactory extends ShardHandlerFactory implements PluginInfoInitialized, SolrMetricProducer
Modifier and Type | Field and Description |
---|---|
protected InstrumentedPoolingClientConnectionManager |
clientConnectionManager |
protected org.apache.http.impl.client.CloseableHttpClient |
defaultClient |
protected UpdateShardHandler.IdleConnectionsEvictor |
idleConnectionsEvictor |
protected Random |
r |
DEFAULT_SHARDHANDLER_INFO
Constructor and Description |
---|
HttpShardHandlerFactory() |
Modifier and Type | Method and Description |
---|---|
List<String> |
buildURLList(String shard)
Creates a list of urls for the given shard.
|
void |
close() |
protected LBHttpSolrClient |
createLoadbalancer(org.apache.http.client.HttpClient httpClient) |
protected ModifiableSolrParams |
getClientParams() |
protected <T> T |
getParameter(NamedList initArgs,
String configKey,
T defaultValue,
StringBuilder sb) |
protected ReplicaListTransformer |
getReplicaListTransformer(SolrQueryRequest req) |
ShardHandler |
getShardHandler()
Get
ShardHandler that uses the default http client. |
ShardHandler |
getShardHandler(org.apache.http.client.HttpClient httpClient)
Get
ShardHandler that uses custom http client. |
protected ExecutorService |
getThreadPoolExecutor() |
void |
init(PluginInfo info) |
void |
initializeMetrics(SolrMetricManager manager,
String registry,
String scope)
Initializes metrics specific to this producer
|
LBHttpSolrClient.Rsp |
makeLoadBalancedRequest(QueryRequest req,
List<String> urls)
Makes a request to one or more of the given urls, using the configured load balancer.
|
CompletionService |
newCompletionService()
Creates a new completion service for use by a single set of distributed requests.
|
void |
reconfigureHttpClient(HttpClientConfigurer configurer)
For an already created internal httpclient, this can be used to configure it
again.
|
newInstance
protected InstrumentedPoolingClientConnectionManager clientConnectionManager
protected org.apache.http.impl.client.CloseableHttpClient defaultClient
protected UpdateShardHandler.IdleConnectionsEvictor idleConnectionsEvictor
protected final Random r
public ShardHandler getShardHandler()
ShardHandler
that uses the default http client.getShardHandler
in class ShardHandlerFactory
public ShardHandler getShardHandler(org.apache.http.client.HttpClient httpClient)
ShardHandler
that uses custom http client.public void init(PluginInfo info)
init
in interface PluginInfoInitialized
protected ModifiableSolrParams getClientParams()
public void reconfigureHttpClient(HttpClientConfigurer configurer)
configurer
- an HttpClientConfigurer instanceprotected ExecutorService getThreadPoolExecutor()
protected LBHttpSolrClient createLoadbalancer(org.apache.http.client.HttpClient httpClient)
protected <T> T getParameter(NamedList initArgs, String configKey, T defaultValue, StringBuilder sb)
public void close()
close
in class ShardHandlerFactory
public LBHttpSolrClient.Rsp makeLoadBalancedRequest(QueryRequest req, List<String> urls) throws SolrServerException, IOException
req
- The solr search request that should be sent through the load balancerurls
- The list of solr server urls to load balance acrossSolrServerException
IOException
public List<String> buildURLList(String shard)
shard
- the urls for the shard, separated by '|'protected ReplicaListTransformer getReplicaListTransformer(SolrQueryRequest req)
public CompletionService newCompletionService()
public void initializeMetrics(SolrMetricManager manager, String registry, String scope)
SolrMetricProducer
initializeMetrics
in interface SolrMetricProducer
manager
- an instance of SolrMetricManager
registry
- registry name where metrics are registeredscope
- scope of the metrics (eg. handler name) to separate metrics of
instances of the same component executing in different contextsCopyright © 2000-2017 Apache Software Foundation. All Rights Reserved.