Class ClusterMessage


  • public class ClusterMessage
    extends java.lang.Object
    Base message for cluster-wide communications.
    • Constructor Detail

      • ClusterMessage

        public ClusterMessage​(NodeId sender,
                              MessageSubject subject,
                              byte[] payload)
        Creates a cluster message.
        Parameters:
        sender - message sender
        subject - message subject
        payload - message payload
    • Method Detail

      • sender

        public NodeId sender()
        Returns the id of the controller sending this message.
        Returns:
        message sender id.
      • subject

        public MessageSubject subject()
        Returns the message subject indicator.
        Returns:
        message subject
      • payload

        public byte[] payload()
        Returns the message payload.
        Returns:
        message payload.
      • respond

        public void respond​(byte[] data)
        Records the response to be sent to the sender.
        Parameters:
        data - response payload
      • response

        public byte[] response()
        Returns the response to be sent to the sender.
        Returns:
        response bytes
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • getBytes

        public byte[] getBytes()
        Serializes this instance.
        Returns:
        bytes
      • fromBytes

        public static ClusterMessage fromBytes​(byte[] bytes)
        Decodes a new ClusterMessage from raw bytes.
        Parameters:
        bytes - raw bytes
        Returns:
        cluster message
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object