Class ClusterMessage
- java.lang.Object
-
- org.onosproject.store.cluster.messaging.ClusterMessage
-
public class ClusterMessage extends java.lang.ObjectBase message for cluster-wide communications.
-
-
Constructor Summary
Constructors Constructor Description ClusterMessage(NodeId sender, MessageSubject subject, byte[] payload)Creates a cluster message.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static ClusterMessagefromBytes(byte[] bytes)Decodes a new ClusterMessage from raw bytes.byte[]getBytes()Serializes this instance.inthashCode()byte[]payload()Returns the message payload.voidrespond(byte[] data)Records the response to be sent to the sender.byte[]response()Returns the response to be sent to the sender.NodeIdsender()Returns the id of the controller sending this message.MessageSubjectsubject()Returns the message subject indicator.java.lang.StringtoString()
-
-
-
Constructor Detail
-
ClusterMessage
public ClusterMessage(NodeId sender, MessageSubject subject, byte[] payload)
Creates a cluster message.- Parameters:
sender- message sendersubject- message subjectpayload- 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:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.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:
hashCodein classjava.lang.Object
-
-