Class GroupId

java.lang.Object
org.opends.server.discovery.GroupId

public final class GroupId extends Object
This class represents a replication group ID which allows grouping DJ instances by setting the same group ID on several DJ instances. For example, you would group DJ instances that are in the same datacenter so that they would preferentially connect to RS instances in the same datacenter. This allows to reduce cross datacenter communications across WAN and thus reduces costs.

In DJ versions previous to 6.5, group IDs are represented as integers (byte). Since 6.5, group IDs are represented as case-insensitive strings. This class helps converting to/from old/new group IDs to deal with legacy protocol versions.

  • Field Details

    • DEFAULT_GROUP_ID_STRING

      public static final String DEFAULT_GROUP_ID_STRING
      Default value for replication group ids.
      See Also:
    • DEFAULT_GROUP_ID

      public static final GroupId DEFAULT_GROUP_ID
      The default group ID to use when no group ID is set by the users.
  • Method Details

    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toLegacyGroupId

      public byte toLegacyGroupId()
      Maps a string groupID to a format accepted by legacy versions of the replication, if possible.

      Strings representing a number from 1 to 127 (as supported by legacy versions) will return the integer value. All others will return 1.

      Returns:
      the byte representation of this groupId
    • fromLegacyGroupId

      public static GroupId fromLegacyGroupId(byte legacyGroupId)
      Returns a GroupId from a replication message sent by a replica running a legacy version.
      Parameters:
      legacyGroupId - the groupID from a replication message
      Returns:
      a GroupId
    • newGroupId

      public static GroupId newGroupId(String groupId)
      Generates a new GroupId from the provided value.
      Parameters:
      groupId - the new groupID
      Returns:
      a new GroupId
    • toString

      public String toString()
      Overrides:
      toString in class Object