Package org.apache.solr.common.cloud

## Enum Replica.State

- java.lang.Object
- - java.lang.Enum<Replica.State>
  - - org.apache.solr.common.cloud.Replica.State

All Implemented Interfaces:
  `Serializable`, `Comparable<Replica.State>`

Enclosing class:
  Replica

    public static enum Replica.State
    extends Enum<Replica.State>

The replica's state. In general, if the node the replica is hosted on is not under `/live_nodes` in ZK, the replica's state should be discarded.

### Enum Constant Summary

Enum Constants
`ACTIVE` The replica is ready to receive updates and queries.
`DOWN` The first state before `RECOVERING`.
`RECOVERING` The node is recovering from the leader.
`RECOVERY_FAILED` Recovery attempts have not worked, something is not right.

### Field Summary

Fields
`String` `shortName` short name for a state.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Replica.State` `getState​(String stateStr)` Converts the state string to a State instance.
`String` `toString()`
`static Replica.State` `valueOf​(String name)` Returns the enum constant of this type with the specified name.
`static Replica.State[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

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

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### ACTIVE

    public static final Replica.State ACTIVE

The replica is ready to receive updates and queries.

NOTE: when the node the replica is hosted on crashes, the replica's state may remain ACTIVE in ZK. To determine if the replica is truly active, you must also verify that its `node` is under `/live_nodes` in ZK (or use `ClusterState.liveNodesContain(String)`).

#### DOWN

    public static final Replica.State DOWN

The first state before `RECOVERING`. A node in this state should be actively trying to move to `RECOVERING`.

NOTE: a replica's state may appear DOWN in ZK also when the node it's hosted on gracefully shuts down. This is a best effort though, and should not be relied on.

#### RECOVERING

    public static final Replica.State RECOVERING

The node is recovering from the leader. This might involve peer-sync, full replication or finding out things are already in sync.

#### RECOVERY_FAILED

    public static final Replica.State RECOVERY_FAILED

Recovery attempts have not worked, something is not right.

NOTE: This state doesn't matter if the node is not part of `/live_nodes` in ZK; in that case the node is not part of the cluster and it's state should be discarded.

### Field Detail

#### shortName

    public final String shortName

short name for a state. Used to encode this in the state node see `PerReplicaStates.State`

### Method Detail

#### values

    public static Replica.State[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

    for (Replica.State c : Replica.State.values())
        System.out.println(c);

Returns:
  an array containing the constants of this enum type, in the order they are declared

#### valueOf

    public static Replica.State valueOf​(String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum type has no constant with the specified name
  `NullPointerException` - if the argument is null

#### toString

    public String toString()

Overrides:
  `toString` in class `Enum<Replica.State>`

#### getState

    public static Replica.State getState​(String stateStr)

Converts the state string to a State instance.