Package org.apache.solr.client.solrj.routing

# Class AffinityReplicaListTransformerFactory

java.lang.Object
org.apache.solr.client.solrj.routing.AffinityReplicaListTransformerFactory

All Implemented Interfaces:
  `ReplicaListTransformerFactory`

public class AffinityReplicaListTransformerFactory extends Object implements ReplicaListTransformerFactory
Factory for constructing an `AffinityReplicaListTransformer` that reorders replica routing preferences deterministically, based on request parameters.

Default names of params that contain the values by which routing is determined may be configured at the time of `AffinityReplicaListTransformerFactory` construction, and may be overridden by the config spec passed to `getInstance(String, SolrParams, ReplicaListTransformerFactory)`

If no defaultHashParam name is specified at time of factory construction, the routing dividend will be derived by hashing the `String` value of the `CommonParams.Q` param.

## Constructor Summary

Constructors
Constructor
Description
`AffinityReplicaListTransformerFactory()`
`AffinityReplicaListTransformerFactory(String defaultDividendParam, String defaultHashParam)`
`AffinityReplicaListTransformerFactory(NamedList<?> c)`

## Method Summary

Modifier and Type
Method
Description
`ReplicaListTransformer`
`getInstance(String configSpec, SolrParams requestParams, ReplicaListTransformerFactory fallback)`

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

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

## Constructor Details

### AffinityReplicaListTransformerFactory

public AffinityReplicaListTransformerFactory()

### AffinityReplicaListTransformerFactory

public AffinityReplicaListTransformerFactory(String defaultDividendParam, String defaultHashParam)

### AffinityReplicaListTransformerFactory

public AffinityReplicaListTransformerFactory(NamedList<?> c)

## Method Details

### getInstance

public ReplicaListTransformer getInstance(String configSpec, SolrParams requestParams, ReplicaListTransformerFactory fallback)

Specified by:
  `getInstance` in interface `ReplicaListTransformerFactory`
Parameters:
  `configSpec` - spec for dynamic configuration of ReplicaListTransformer
  `requestParams` - the request parameters for which the ReplicaListTransformer is being generated
  `fallback` - used to generate fallback value; the getInstance() method of the specified fallback must not return null; The fallback value itself may be null if this implementation is known to never return null (i.e., if fallback will never be needed)
Returns:
  ReplicaListTransformer to be used for routing this request