org.apache.solr.handler.component

## 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:
    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 Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TrackingShardHandlerFactory.RequestTrackingQueue` A queue having helper methods to select requests by shard and purpose.
    `static class` | `TrackingShardHandlerFactory.ShardRequestAndParams`

  - ### Field Summary

    - ### Fields inherited from class org.apache.solr.handler.component.HttpShardHandlerFactory

      `clientConnectionManager, defaultClient, idleConnectionsEvictor`

    - ### Fields inherited from class org.apache.solr.handler.component.ShardHandlerFactory

      `DEFAULT_SHARDHANDLER_INFO`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TrackingShardHandlerFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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.
    `static void` | `setTrackingQueue(MiniSolrCloudCluster cluster, 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.

    - ### Methods inherited from class org.apache.solr.handler.component.HttpShardHandlerFactory

      `createLoadbalancer, getClientParams, getParameter, getShardHandler, getThreadPoolExecutor, init, makeLoadBalancedRequest, makeURLList, newCompletionService, reconfigureHttpClient`

    - ### Methods inherited from class org.apache.solr.handler.component.ShardHandlerFactory

      `newInstance`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TrackingShardHandlerFactory

          public TrackingShardHandlerFactory()

  - ### 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 call `Queue.offer(Object)` with a `TrackingShardHandlerFactory.ShardRequestAndParams` instance whenever `ShardHandler.submit(ShardRequest, String, org.apache.solr.common.params.ModifiableSolrParams)` is called before the request is actually submitted to the wrapped `HttpShardHandlerFactory` instance.

      If a tracking queue is already set then this call will overwrite and replace the previous queue with this one.

      Parameters:
        `queue` - the `Queue` 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 class `org.apache.solr.handler.component.HttpShardHandlerFactory`

    - #### close

          public void close()

      Overrides:
        `close` in class `org.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(java.util.List, java.util.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 of `JettySolrRunner` nodes
        `queue` - an implementation of `Queue` which accepts `TrackingShardHandlerFactory.ShardRequestAndParams` instances

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.