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

## Class SolrClientNodeStateProvider

- java.lang.Object
- - org.apache.solr.client.solrj.impl.SolrClientNodeStateProvider

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `NodeStateProvider`, `MapSerializable`, `MapWriter`, `NavigableObject`, `SolrCloseable`

    public class SolrClientNodeStateProvider
    extends Object
    implements NodeStateProvider, MapWriter

The real `NodeStateProvider`, which communicates with Solr via SolrJ.

### Nested Class Summary

Nested Classes
`static class` `SolrClientNodeStateProvider.Variable`

### Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

### Field Summary

Fields
`static String` `METRICS_PREFIX`
`protected Map<String,​Map<String,​Map<String,​List<Replica>>>>` `nodeVsCollectionVsShardVsReplicaInfo`

### Constructor Summary

Constructors
`SolrClientNodeStateProvider​(CloudLegacySolrClient solrClient)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`protected Map<String,​Object>` `fetchReplicaMetrics​(String node, Map<String,​Pair<String,​Replica>> metricsKeyVsTagReplica)`
`protected Map<String,​Object>` `fetchTagValues​(String node, Collection<String> tags)`
`void` `forEachReplica​(String node, Consumer<Replica> consumer)`
`static void` `forEachReplica​(Map<String,​Map<String,​List<Replica>>> collectionVsShardVsReplicas, Consumer<Replica> consumer)`
`protected ClusterStateProvider` `getClusterStateProvider()`
`Map<String,​Object>` `getNodeValues​(String node, Collection<String> tags)` Get the value of each tag for a given node
`Map<String,​Map<String,​List<Replica>>>` `getReplicaInfo​(String node, Collection<String> keys)` Get the details of each replica in a node.
`protected void` `readReplicaDetails()`
`String` `toString()`
`void` `writeMap​(MapWriter.EntryWriter ew)`

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

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

### Methods inherited from interface org.apache.solr.common.MapWriter

`jsonStr, toMap`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size`

### Methods inherited from interface org.apache.solr.common.SolrCloseable

`isClosed`

### Field Detail

#### METRICS_PREFIX

    public static final String METRICS_PREFIX

See Also:
  Constant Field Values

#### nodeVsCollectionVsShardVsReplicaInfo

    protected final Map<String,​Map<String,​Map<String,​List<Replica>>>> nodeVsCollectionVsShardVsReplicaInfo

### Constructor Detail

#### SolrClientNodeStateProvider

    public SolrClientNodeStateProvider​(CloudLegacySolrClient solrClient)

### Method Detail

#### getClusterStateProvider

    protected ClusterStateProvider getClusterStateProvider()

#### readReplicaDetails

    protected void readReplicaDetails()
                               throws IOException

Throws:
  `IOException`

#### writeMap

    public void writeMap​(MapWriter.EntryWriter ew)
                  throws IOException

Specified by:
  `writeMap` in interface `MapWriter`
Throws:
  `IOException`

#### getNodeValues

    public Map<String,​Object> getNodeValues​(String node,
                                                  Collection<String> tags)

Description copied from interface: `NodeStateProvider`
Get the value of each tag for a given node

Specified by:
  `getNodeValues` in interface `NodeStateProvider`
Parameters:
  `node` - node name
  `tags` - tag names
Returns:
  a map of tag vs value

#### fetchTagValues

    protected Map<String,​Object> fetchTagValues​(String node,
                                                      Collection<String> tags)

#### forEachReplica

    public void forEachReplica​(String node,
                               Consumer<Replica> consumer)

#### forEachReplica

    public static void forEachReplica​(Map<String,​Map<String,​List<Replica>>> collectionVsShardVsReplicas,
                                      Consumer<Replica> consumer)

#### getReplicaInfo

    public Map<String,​Map<String,​List<Replica>>> getReplicaInfo​(String node,
                                                                            Collection<String> keys)

Description copied from interface: `NodeStateProvider`
Get the details of each replica in a node. It attempts to fetch as much details about the replica as mentioned in the keys list. It is not necessary to give all details

The format is {collection:shard :[{replicadetails}]}.

Specified by:
  `getReplicaInfo` in interface `NodeStateProvider`
Returns:
  map of replica infos per collection/shard

#### fetchReplicaMetrics

    protected Map<String,​Object> fetchReplicaMetrics​(String node,
                                                           Map<String,​Pair<String,​Replica>> metricsKeyVsTagReplica)

#### close

    public void close()
               throws IOException

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

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`