Class ReplicaId

java.lang.Object
org.opends.server.replication.common.ReplicaId
All Implemented Interfaces:
Comparable<ReplicaId>, ServerId<ReplicaId>

public final class ReplicaId extends Object implements ServerId<ReplicaId>
Represents the server ID for a replica, called a replica ID.

The Server ID for a replica is represented both with a name and a numeric value:

  • The name is a string, used for user interfaces (configuration, logs, monitoring, ...)
  • The numeric value is an integer, needed because it is used in CSNs (there is no intent to change this) and for compatibility with previous replication protocol versions. The numeric id should not be exposed in user interfaces.
Names of Server IDs are case-insensitive, i.e. "server1" and "Server1" are considered to be equal.
  • Method Details

    • allReplicas

      public static ReplicaId allReplicas()
      Returns the special id corresponding to "all replicas".
      Returns:
      the "all replica" id
    • nullReplicaId

      public static ReplicaId nullReplicaId()
      Returns the special id corresponding to the null replica id.
      Returns:
      the null replica id
    • fromNumericId

      public static ReplicaId fromNumericId(int numericId)
      Generates a new ReplicaId from the provided integer value.
      Parameters:
      numericId - the numeric part of this replica ID
      Returns:
      a new ReplicaId
    • fromReplicaName

      public static ReplicaId fromReplicaName(String name)
      Generates a new ReplicaId from the provided string value.
      Parameters:
      name - the name of this replica ID
      Returns:
      a new ReplicaId
    • normalizedName

      public String normalizedName()
      Description copied from interface: ServerId
      Returns the normalized name of this serverId.
      Specified by:
      normalizedName in interface ServerId<ReplicaId>
      Returns:
      this serverId as a (normalized) String value
    • numericId

      public int numericId()
      Description copied from interface: ServerId
      Returns the numeric value of this serverId, as an int.

      The numeric value is used in the CSNs.

      Specified by:
      numericId in interface ServerId<ReplicaId>
      Returns:
      this serverId as an int value
    • isAllReplicas

      public boolean isAllReplicas()
      Tests whether this id corresponds to all replicas.
      Returns:
      true iff the id corresponds to the "all replicas" id
    • isNullReplicaId

      public boolean isNullReplicaId()
      Tests whether this id corresponds to the null replica id.
      Returns:
      true iff the id is the null replica id.
    • isBackwardCompatibleWithNumericId

      public boolean isBackwardCompatibleWithNumericId()
      Description copied from interface: ServerId
      Returns if the serverId can be used as identifier with replication protocol versions before V11.
      Specified by:
      isBackwardCompatibleWithNumericId in interface ServerId<ReplicaId>
      Returns:
      if the serverId can be used as identifier with replication protocol versions before V11
    • compareTo

      public int compareTo(ReplicaId o)
      Specified by:
      compareTo in interface Comparable<ReplicaId>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object