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 testsThis is a test helper only and should *not* be used for production.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TrackingShardHandlerFactory.RequestTrackingQueue
A queue having helper methods to select requests by shard and purpose.static class
TrackingShardHandlerFactory.ShardRequestAndParams
-
Constructor Summary
Constructors Constructor Description TrackingShardHandlerFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
org.apache.solr.handler.component.ShardHandler
getShardHandler()
Queue<TrackingShardHandlerFactory.ShardRequestAndParams>
getTrackingQueue()
boolean
isTracking()
static void
setTrackingQueue(List<org.apache.solr.client.solrj.embedded.JettySolrRunner> runners, Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue)
Sets the tracking queue for all nodes participating in this cluster.void
setTrackingQueue(Queue<TrackingShardHandlerFactory.ShardRequestAndParams> queue)
Set the tracking queue for this factory.static void
setTrackingQueue(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.ShardRequestAndParams
instance wheneverShardHandler.submit(ShardRequest, String, org.apache.solr.common.params.ModifiableSolrParams)
is called before the request is actually submitted to the wrappedHttpShardHandlerFactory
instance.If a tracking queue is already set then this call will overwrite and replace the previous queue with this one.
- Parameters:
queue
- theQueue
to be used for tracking shard requests
-
getTrackingQueue
public Queue<TrackingShardHandlerFactory.ShardRequestAndParams> getTrackingQueue()
- Returns:
- the
Queue
being 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:
getShardHandler
in classorg.apache.solr.handler.component.HttpShardHandlerFactory
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.apache.solr.metrics.SolrMetricProducer
- Overrides:
close
in 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<org.apache.solr.client.solrj.embedded.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 ofJettySolrRunner
nodesqueue
- an implementation ofQueue
which acceptsTrackingShardHandlerFactory.ShardRequestAndParams
instances
-
-