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.HttpShardHandlerFactoryA ShardHandlerFactory that extends HttpShardHandlerFactory and tracks requests made to nodes/shards such that interested parties can watch such requests and make assertions inside testsThis is a test helper only and should *not* be used for production.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTrackingShardHandlerFactory.RequestTrackingQueueA queue having helper methods to select requests by shard and purpose.static classTrackingShardHandlerFactory.ShardRequestAndParams
-
Constructor Summary
Constructors Constructor Description TrackingShardHandlerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()org.apache.solr.handler.component.ShardHandlergetShardHandler()Queue<TrackingShardHandlerFactory.ShardRequestAndParams>getTrackingQueue()booleanisTracking()static voidsetTrackingQueue(List<JettySolrRunner> runners, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue)Sets the tracking queue for all nodes participating in this cluster.voidsetTrackingQueue(Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue)Set 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.
-
-
-
Method Detail
-
setTrackingQueue
public void setTrackingQueue(Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue)
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
public Queue<TrackingShardHandlerFactory.ShardRequestAndParams> 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)
-
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
-
-