org.apache.solr.handler.component

## Class HttpShardHandlerFactory

- java.lang.Object
- - org.apache.solr.handler.component.ShardHandlerFactory
  - - org.apache.solr.handler.component.HttpShardHandlerFactory

- All Implemented Interfaces:
    PluginInfoInitialized

      public class HttpShardHandlerFactory
      extends ShardHandlerFactory
      implements PluginInfoInitialized

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.apache.http.impl.conn.PoolingClientConnectionManager` | `clientConnectionManager`
    `protected org.apache.http.impl.client.CloseableHttpClient` | `defaultClient`
    `protected UpdateShardHandler.IdleConnectionsEvictor` | `idleConnectionsEvictor`

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

      `DEFAULT_SHARDHANDLER_INFO`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpShardHandlerFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected LBHttpSolrClient` | `createLoadbalancer(org.apache.http.client.HttpClient httpClient)`
    `protected ModifiableSolrParams` | `getClientParams()`
    `protected <T> T` | `getParameter(NamedList initArgs, String configKey, T defaultValue, StringBuilder sb)`
    `ShardHandler` | `getShardHandler()` Get `ShardHandler` that uses the default http client.
    `ShardHandler` | `getShardHandler(org.apache.http.client.HttpClient httpClient)` Get `ShardHandler` that uses custom http client.
    `protected ThreadPoolExecutor` | `getThreadPoolExecutor()`
    `void` | `init(PluginInfo info)`
    `LBHttpSolrClient.Rsp` | `makeLoadBalancedRequest(QueryRequest req, List<String> urls)` Makes a request to one or more of the given urls, using the configured load balancer.
    `List<String>` | `makeURLList(String shard)` Creates a randomized list of urls for the given shard.
    `CompletionService` | `newCompletionService()` Creates a new completion service for use by a single set of distributed requests.
    `void` | `reconfigureHttpClient(HttpClientConfigurer configurer)` For an already created internal httpclient, this can be used to configure it again.

    - ### 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`

- - ### Field Detail

    - #### clientConnectionManager

          protected org.apache.http.impl.conn.PoolingClientConnectionManager clientConnectionManager

    - #### defaultClient

          protected org.apache.http.impl.client.CloseableHttpClient defaultClient

    - #### idleConnectionsEvictor

          protected UpdateShardHandler.IdleConnectionsEvictor idleConnectionsEvictor

  - ### Constructor Detail

    - #### HttpShardHandlerFactory

          public HttpShardHandlerFactory()

  - ### Method Detail

    - #### getShardHandler

          public ShardHandler getShardHandler()

      Get `ShardHandler` that uses the default http client.
      Specified by:
        `getShardHandler` in class `ShardHandlerFactory`

    - #### getShardHandler

          public ShardHandler getShardHandler(org.apache.http.client.HttpClient httpClient)

      Get `ShardHandler` that uses custom http client.

    - #### init

          public void init(PluginInfo info)

      Specified by:
        `init` in interface `PluginInfoInitialized`

    - #### getClientParams

          protected ModifiableSolrParams getClientParams()

    - #### reconfigureHttpClient

          public void reconfigureHttpClient(HttpClientConfigurer configurer)

      For an already created internal httpclient, this can be used to configure it again. Useful for authentication plugins.
      Parameters:
        `configurer` - an HttpClientConfigurer instance

    - #### getThreadPoolExecutor

          protected ThreadPoolExecutor getThreadPoolExecutor()

    - #### createLoadbalancer

          protected LBHttpSolrClient createLoadbalancer(org.apache.http.client.HttpClient httpClient)

    - #### getParameter

          protected <T> T getParameter(NamedList initArgs,
                                       String configKey,
                                       T defaultValue,
                                       StringBuilder sb)

    - #### close

          public void close()

      Specified by:
        `close` in class `ShardHandlerFactory`

    - #### makeLoadBalancedRequest

          public LBHttpSolrClient.Rsp makeLoadBalancedRequest(QueryRequest req,
                                                              List<String> urls)
                                                       throws SolrServerException,
                                                              IOException

      Makes a request to one or more of the given urls, using the configured load balancer.
      Parameters:
        `req` - The solr search request that should be sent through the load balancer
        `urls` - The list of solr server urls to load balance across
      Returns:
        The response from the request
      Throws:
        `SolrServerException`
        `IOException`

    - #### makeURLList

          public List<String> makeURLList(String shard)

      Creates a randomized list of urls for the given shard.
      Parameters:
        `shard` - the urls for the shard, separated by '|'
      Returns:
        A list of valid urls (including protocol) that are replicas for the shard

    - #### newCompletionService

          public CompletionService newCompletionService()

      Creates a new completion service for use by a single set of distributed requests.

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