Package org.apache.solr.client.solrj.impl

# Class BaseHttpClusterStateProvider

java.lang.Object
org.apache.solr.client.solrj.impl.BaseHttpClusterStateProvider

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `ClusterStateProvider`, `SolrCloseable`

Direct Known Subclasses:
  `HttpClusterStateProvider`

public abstract class BaseHttpClusterStateProvider extends Object implements ClusterStateProvider

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final String`
`SYS_PROP_CACHE_TIMEOUT_SECONDS`

## Constructor Summary

Constructors
Constructor
Description
`BaseHttpClusterStateProvider()`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`connect()`
`Map<String,String>`
`getAliasProperties(String alias)`
Return alias properties, or an empty map if the alias has no properties.
`int`
`getCacheTimeout()`
`Map<String,Object>`
`getClusterProperties()`
Obtain cluster properties.
`Object`
`getClusterProperty(String propertyName)`
Obtain a cluster property, or null if it doesn't exist.
`ClusterState`
`getClusterState()`
Obtain the current cluster state.
`DocCollection`
`getCollection(String collection)`
`Set<String>`
`getLiveNodes()`
Obtain set of live_nodes for the cluster.
`String`
`getPolicyNameByCollection(String coll)`
Get the collection-specific policy
`String`
`getQuorumHosts()`
`protected abstract SolrClient`
`getSolrClient(String baseUrl)`
Create a SolrClient implementation that uses the specified Solr node URL
`ClusterState.CollectionRef`
`getState(String collection)`
Obtain the state of the collection (cluster status).
`protected void`
`initConfiguredNodes(List<String> solrUrls)`
`boolean`
`isClosed()`
`List<String>`
`resolveAlias(String aliasName)`
Given a collection alias, returns a list of collections it points to, or returns a singleton list of the input if it's not an alias.
`List<String>`
`resolveAlias(String aliasName, boolean forceFetch)`
`String`
`resolveSimpleAlias(String aliasName)`
Given a collection alias, return a single collection it points to, or the original name if it's not an alias.

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

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

### Methods inherited from interface org.apache.solr.client.solrj.impl.ClusterStateProvider

`getClusterProperty, isRoutedAlias`

## Field Details

### SYS_PROP_CACHE_TIMEOUT_SECONDS

protected static final String SYS_PROP_CACHE_TIMEOUT_SECONDS

See Also:
  - Constant Field Values

## Constructor Details

### BaseHttpClusterStateProvider

public BaseHttpClusterStateProvider()

## Method Details

### initConfiguredNodes

protected void initConfiguredNodes(List<String> solrUrls) throws Exception

Throws:
  `Exception`

### connect

public void connect()

Specified by:
  `connect` in interface `ClusterStateProvider`

### getSolrClient

protected abstract SolrClient getSolrClient(String baseUrl)
Create a SolrClient implementation that uses the specified Solr node URL

### getCollection

public DocCollection getCollection(String collection)

Specified by:
  `getCollection` in interface `ClusterStateProvider`

### getState

public ClusterState.CollectionRef getState(String collection)
Description copied from interface: `ClusterStateProvider`
Obtain the state of the collection (cluster status).

Specified by:
  `getState` in interface `ClusterStateProvider`
Returns:
  the collection state, or null only if collection doesn't exist

### getLiveNodes

public Set<String> getLiveNodes()
Description copied from interface: `ClusterStateProvider`
Obtain set of live_nodes for the cluster.

Specified by:
  `getLiveNodes` in interface `ClusterStateProvider`

### resolveAlias

public List<String> resolveAlias(String aliasName)
Description copied from interface: `ClusterStateProvider`
Given a collection alias, returns a list of collections it points to, or returns a singleton list of the input if it's not an alias.

Specified by:
  `resolveAlias` in interface `ClusterStateProvider`

### resolveAlias

public List<String> resolveAlias(String aliasName, boolean forceFetch)

### resolveSimpleAlias

public String resolveSimpleAlias(String aliasName) throws IllegalArgumentException
Description copied from interface: `ClusterStateProvider`
Given a collection alias, return a single collection it points to, or the original name if it's not an alias.

Specified by:
  `resolveSimpleAlias` in interface `ClusterStateProvider`
Throws:
  `IllegalArgumentException` - if an alias points to more than 1 collection, either directly or indirectly.

### getAliasProperties

public Map<String,String> getAliasProperties(String alias)
Description copied from interface: `ClusterStateProvider`
Return alias properties, or an empty map if the alias has no properties.

Specified by:
  `getAliasProperties` in interface `ClusterStateProvider`

### getClusterState

public ClusterState getClusterState()
Description copied from interface: `ClusterStateProvider`
Obtain the current cluster state. WARNING: This method is quite expensive as it involves fetching remote information. Use with caution and be aware of the potential performance implications.

Specified by:
  `getClusterState` in interface `ClusterStateProvider`

### getClusterProperties

public Map<String,Object> getClusterProperties()
Description copied from interface: `ClusterStateProvider`
Obtain cluster properties.

Specified by:
  `getClusterProperties` in interface `ClusterStateProvider`
Returns:
  configured cluster properties, or an empty map, never null.

### getPolicyNameByCollection

public String getPolicyNameByCollection(String coll)
Description copied from interface: `ClusterStateProvider`
Get the collection-specific policy

Specified by:
  `getPolicyNameByCollection` in interface `ClusterStateProvider`

### getClusterProperty

public Object getClusterProperty(String propertyName)
Description copied from interface: `ClusterStateProvider`
Obtain a cluster property, or null if it doesn't exist.

Specified by:
  `getClusterProperty` in interface `ClusterStateProvider`

### getCacheTimeout

public int getCacheTimeout()

### getQuorumHosts

public String getQuorumHosts()

Specified by:
  `getQuorumHosts` in interface `ClusterStateProvider`

### isClosed

public boolean isClosed()

Specified by:
  `isClosed` in interface `SolrCloseable`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Throws:
  `IOException`