Class ChangeStatusMsg


  • public final class ChangeStatusMsg
    extends ReplicationMsg
    This message is used by the replica to tell the replication server he is changing his status (new status field used), or by the replication server to request that the replica changes his status (requested status field used).
    • Method Detail

      • requestThatDsChangesStatusTo

        public static ChangeStatusMsg requestThatDsChangesStatusTo​(ServerStatus requestedStatus)
        Create a new ChangeStatusMsg suitable for sending from a replication server to a replica. This message means the RS requests that the DS changes its status to the requested status. This request may fail if the transition is not allowed (for example, the DS may already have transitioned to a different status).
        Parameters:
        requestedStatus - The requested status
        Returns:
        a ChangeStatusMsg object that can be used by an RS to request that a DS changes its status to the provided one
      • signalThatDsStatusChangedTo

        public static ChangeStatusMsg signalThatDsStatusChangedTo​(ServerStatus newStatus)
        Create a new ChangeStatusMsg suitable for sending from a replica to a replication server. This message signals that the DS status has changed to the new value. Note: this change already happened somewhere in the past, and by the time this message is processed by the RS, it is possible that the DS has transitioned to yet another status.
        Parameters:
        newStatus - The new status
        Returns:
        a ChangeStatusMsg object that can be used by a DS to signal to its RS that it changed its status to the provided one
      • getBytes

        public byte[] getBytes​(short protocolVersion)
        Description copied from class: ReplicationMsg
        Serializes the PDU using the provided replication protocol version. WARNING: should be overwritten by a PDU (sub class) we want to support older protocol version serialization for.
        Specified by:
        getBytes in class ReplicationMsg
        Parameters:
        protocolVersion - The protocol version to use for serialization. The version should normally be older than the current one.
        Returns:
        The encoded PDU, or null if the message isn't supported in that protocol version.
      • getRequestedStatus

        public ServerStatus getRequestedStatus()
        Get the requested status, i.e. the status we want the DS to enter (used when from RS to DS).
        Returns:
        The requested status
      • getNewStatus

        public ServerStatus getNewStatus()
        Get the new status, i.e. the new status the DS just entered (used when from DS to RS).
        Returns:
        The new status