Class TrackingShardHandlerFactory
java.lang.Object
org.apache.solr.handler.component.ShardHandlerFactory
org.apache.solr.handler.component.HttpShardHandlerFactory
org.apache.solr.handler.component.TrackingShardHandlerFactory
- All Implemented Interfaces:
AutoCloseable,org.apache.solr.metrics.SolrMetricProducer,org.apache.solr.util.plugin.PluginInfoInitialized
public class TrackingShardHandlerFactory
extends org.apache.solr.handler.component.HttpShardHandlerFactory
A ShardHandlerFactory that extends HttpShardHandlerFactory and tracks requests made to
nodes/shards such that interested parties can watch such requests and make assertions inside
tests
This is a test helper only and should *not* be used for production.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA queue having helper methods to select requests by shard and purpose.static class -
Field Summary
Fields inherited from class org.apache.solr.handler.component.HttpShardHandlerFactory
commExecutor, defaultClient, httpListenerFactory, loadbalancer, rFields inherited from class org.apache.solr.handler.component.ShardHandlerFactory
DEFAULT_SHARDHANDLER_INFOFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()org.apache.solr.handler.component.ShardHandlerbooleanstatic voidsetTrackingQueue(List<JettySolrRunner> runners, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue) Sets the tracking queue for all nodes participating in this cluster.voidSet the tracking queue for this factory.static voidsetTrackingQueue(MiniSolrCloudCluster cluster, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue) Sets the tracking queue for all nodes participating in this cluster.Methods inherited from class org.apache.solr.handler.component.HttpShardHandlerFactory
buildURLList, getClient, getParameter, getReplicaListTransformer, getSolrMetricsContext, init, initializeMetrics, newLBHttpSolrClientReq, setSecurityBuilderMethods inherited from class org.apache.solr.handler.component.ShardHandlerFactory
newInstance
-
Constructor Details
-
TrackingShardHandlerFactory
public TrackingShardHandlerFactory()
-
-
Method Details
-
setTrackingQueue
Set the tracking queue for this factory. All the ShardHandler instances created from this factory will share the queue and callQueue.offer(Object)with aTrackingShardHandlerFactory.ShardRequestAndParamsinstance wheneverShardHandler.submit(ShardRequest, String, org.apache.solr.common.params.ModifiableSolrParams)is called before the request is actually submitted to the wrappedHttpShardHandlerFactoryinstance.If a tracking queue is already set then this call will overwrite and replace the previous queue with this one.
- Parameters:
queue- theQueueto be used for tracking shard requests
-
getTrackingQueue
- Returns:
- the
Queuebeing used for tracking, null if none has been set
-
isTracking
public boolean isTracking()- Returns:
- true if a tracking queue has been set through
setTrackingQueue(java.util.List, java.util.Queue), false otherwise
-
getShardHandler
public org.apache.solr.handler.component.ShardHandler getShardHandler()- Overrides:
getShardHandlerin classorg.apache.solr.handler.component.HttpShardHandlerFactory
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceorg.apache.solr.metrics.SolrMetricProducer- Overrides:
closein classorg.apache.solr.handler.component.HttpShardHandlerFactory
-
setTrackingQueue
public static void setTrackingQueue(MiniSolrCloudCluster cluster, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue) Sets the tracking queue for all nodes participating in this cluster. Once this method returns, all search and core admin requests distributed to shards will be submitted to the given queue.This is equivalent to calling:
TrackingShardHandlerFactory.setTrackingQueue(cluster.getJettySolrRunners(), queue)- See Also:
-
setTrackingQueue
public static void setTrackingQueue(List<JettySolrRunner> runners, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue) Sets the tracking queue for all nodes participating in this cluster. Once this method returns, all search and core admin requests distributed to shards will be submitted to the given queue.- Parameters:
runners- a list ofJettySolrRunnernodesqueue- an implementation ofQueuewhich acceptsTrackingShardHandlerFactory.ShardRequestAndParamsinstances
-