Class MonitorMsg


  • public final class MonitorMsg
    extends ReplicationMsg
    The monitor message is sent by a RS to either a DS or a RS.

    DS1 or RS1 sends a MonitorRequestMessage to RS2 to requests its monitoring information. When RS2 receives a MonitorRequestMessage from DS1 or RS1, RS2 responds with a MonitorMsg.

    • Constructor Detail

      • MonitorMsg

        public MonitorMsg​(int sender,
                          int destination)
        Creates a new MonitorMsg.
        Parameters:
        sender - The sender of this message.
        destination - The destination of this message.
    • Method Detail

      • setReplServerDbState

        public void setReplServerDbState​(ServerState state)
        Sets the state of the replication server.
        Parameters:
        state - The state.
      • setServerState

        public void setServerState​(int serverId,
                                   ServerState state,
                                   boolean isReplica)
        Sets server state information for a server.
        Parameters:
        serverId - The serverID.
        state - The server state.
        isReplica - Specifies whether the server is a DS or a RS
      • getReplicaServerStates

        public Map<Integer,​ServerState> getReplicaServerStates()
        Returns the map of replica Ids to server states.
        Returns:
        The server states of the replicas.
      • getRsServerStates

        public Map<Integer,​ServerState> getRsServerStates()
        Returns the map of replication server Ids to server states.
        Returns:
        The server states of the replication servers.
      • 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.
      • getReplServerDbState

        public ServerState getReplServerDbState()
        Get the state of the replication server that sent this message.
        Returns:
        The state.
      • getDestination

        public int getDestination()
        Get the destination.
        Returns:
        the destination
      • getSenderID

        public int getSenderID()
        Get the server ID of the server that sent this message.
        Returns:
        the server id