public class HttpShardHandlerFactory extends ShardHandlerFactory implements PluginInfoInitialized, SolrMetricProducer
Modifier and Type | Class and Description |
---|---|
static class |
HttpShardHandlerFactory.WhitelistHostChecker
Class used to validate the hosts in the "shards" parameter when doing a distributed
request
|
Modifier and Type | Field and Description |
---|---|
protected Http2SolrClient |
defaultClient |
protected InstrumentedHttpListenerFactory |
httpListenerFactory |
static String |
INIT_SHARDS_WHITELIST |
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()
Implementations should always call
SolrMetricProducer.super.close() to ensure that
metrics with the same life-cycle as this component are properly unregistered. |
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(Http2SolrClient httpClient)
Get
ShardHandler that uses custom http client. |
ShardHandler |
getShardHandler(org.apache.http.client.HttpClient httpClient)
Deprecated.
|
HttpShardHandlerFactory.WhitelistHostChecker |
getWhitelistHostChecker()
Returns this Factory's
HttpShardHandlerFactory.WhitelistHostChecker . |
void |
init(PluginInfo info) |
void |
initializeMetrics(SolrMetricManager manager,
String registry,
String tag,
String scope)
Initializes metrics specific to this producer
|
LBSolrClient.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.
|
protected LBSolrClient.Req |
newLBHttpSolrClientReq(QueryRequest req,
List<String> urls) |
void |
setSecurityBuilder(HttpClientBuilderPlugin clientBuilderPlugin) |
newInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSolrMetricsContext, getUniqueMetricTag, initializeMetrics
protected volatile Http2SolrClient defaultClient
protected InstrumentedHttpListenerFactory httpListenerFactory
protected final Random r
public static final String INIT_SHARDS_WHITELIST
public ShardHandler getShardHandler()
ShardHandler
that uses the default http client.getShardHandler
in class ShardHandlerFactory
public ShardHandler getShardHandler(Http2SolrClient httpClient)
ShardHandler
that uses custom http client.@Deprecated public ShardHandler getShardHandler(org.apache.http.client.HttpClient httpClient)
public HttpShardHandlerFactory.WhitelistHostChecker getWhitelistHostChecker()
HttpShardHandlerFactory.WhitelistHostChecker
.
This method can be overridden to change the checker implementation.public void init(PluginInfo info)
init
in interface PluginInfoInitialized
public void setSecurityBuilder(HttpClientBuilderPlugin clientBuilderPlugin)
setSecurityBuilder
in class ShardHandlerFactory
protected <T> T getParameter(NamedList initArgs, String configKey, T defaultValue, StringBuilder sb)
public void close()
SolrMetricProducer
SolrMetricProducer.super.close()
to ensure that
metrics with the same life-cycle as this component are properly unregistered. This prevents
obscure memory leaks.close
in interface AutoCloseable
close
in interface SolrMetricProducer
close
in class ShardHandlerFactory
public LBSolrClient.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
protected LBSolrClient.Req newLBHttpSolrClientReq(QueryRequest req, List<String> urls)
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 tag, String scope)
SolrMetricProducer
initializeMetrics
in interface SolrMetricProducer
manager
- an instance of SolrMetricManager
registry
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer,
or a group of related instances that have the same life-cycle. This tag is
used when managing life-cycle of some metrics.scope
- scope of the metrics (eg. handler name) to separate metrics of components with
the same implementation but different scope.Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.