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 |
static String |
INIT_SOLR_DISABLE_SHARDS_WHITELIST |
protected Random |
r |
static String |
SET_SOLR_DISABLE_SHARDS_WHITELIST_CLUE |
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<ShardResponse> |
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 static final String INIT_SOLR_DISABLE_SHARDS_WHITELIST
public static final String SET_SOLR_DISABLE_SHARDS_WHITELIST_CLUE
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.
from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
While this interface method is declared to throw Exception, implementers are strongly encouraged
to declare concrete implementations of the close method to throw more specific exceptions, or to
throw no exception at all if the close operation cannot fail.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<ShardResponse> 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-2021 Apache Software Foundation. All Rights Reserved.