Record Class SwimGossipProtocol.GossipMessage
java.lang.Object
java.lang.Record
com.loomcache.server.cluster.SwimGossipProtocol.GossipMessage
- Record Components:
type- message typesourceNodeId- sender of the messagetargetNodeId- member being referencedincarnation- incarnation number of the targetdisseminationCount- remaining disseminations before message is droppedtimestamp- message creation timestamp (milliseconds)
- Enclosing class:
SwimGossipProtocol
public static record SwimGossipProtocol.GossipMessage(SwimGossipProtocol.GossipMessageType type, String sourceNodeId, String targetNodeId, long incarnation, int disseminationCount, long timestamp)
extends Record
Gossip message with dissemination tracking.
-
Constructor Summary
ConstructorsConstructorDescriptionGossipMessage(SwimGossipProtocol.GossipMessageType type, String sourceNodeId, String targetNodeId, long incarnation, int disseminationCount, long timestamp) Creates an instance of aGossipMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncreate(SwimGossipProtocol.GossipMessageType type, String sourceNodeId, String targetNodeId, long incarnation, int initialDisseminationCount) Create a gossip message with initial dissemination count.Decrement dissemination count.intReturns the value of thedisseminationCountrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of theincarnationrecord component.booleanCheck if this message should still be disseminated.Returns the value of thesourceNodeIdrecord component.Returns the value of thetargetNodeIdrecord component.longReturns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
GossipMessage
public GossipMessage(SwimGossipProtocol.GossipMessageType type, String sourceNodeId, String targetNodeId, long incarnation, int disseminationCount, long timestamp) Creates an instance of aGossipMessagerecord class.- Parameters:
type- the value for thetyperecord componentsourceNodeId- the value for thesourceNodeIdrecord componenttargetNodeId- the value for thetargetNodeIdrecord componentincarnation- the value for theincarnationrecord componentdisseminationCount- the value for thedisseminationCountrecord componenttimestamp- the value for thetimestamprecord component
-
-
Method Details
-
create
public static SwimGossipProtocol.GossipMessage create(SwimGossipProtocol.GossipMessageType type, String sourceNodeId, String targetNodeId, long incarnation, int initialDisseminationCount) Create a gossip message with initial dissemination count. -
decrementDissemination
Decrement dissemination count.- Returns:
- new message with decremented dissemination count
-
shouldDisseminate
public boolean shouldDisseminate()Check if this message should still be disseminated.- Returns:
- true if disseminationCount > 0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
-
sourceNodeId
Returns the value of thesourceNodeIdrecord component.- Returns:
- the value of the
sourceNodeIdrecord component
-
targetNodeId
Returns the value of thetargetNodeIdrecord component.- Returns:
- the value of the
targetNodeIdrecord component
-
incarnation
public long incarnation()Returns the value of theincarnationrecord component.- Returns:
- the value of the
incarnationrecord component
-
disseminationCount
public int disseminationCount()Returns the value of thedisseminationCountrecord component.- Returns:
- the value of the
disseminationCountrecord component
-
timestamp
-