Record Class RoleChangeNotification
java.lang.Object
java.lang.Record
org.opendaylight.controller.cluster.notifications.RoleChangeNotification
- All Implemented Interfaces:
Serializable
@NonNullByDefault
public record RoleChangeNotification(String memberId, @Nullable String oldRole, String newRole)
extends Record
implements Serializable
Notification message representing a Role change of a cluster member.
Roles generally are Leader, Follower and Candidate. But can be based on the consensus strategy/implementation.
The Listener could be in a separate ActorSystem and hence this message needs to be Serializable.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRoleChangeNotification
(String memberId, @Nullable String oldRole, String newRole) Creates an instance of aRoleChangeNotification
record class.RoleChangeNotification
(String memberId, RaftRole newRole) RoleChangeNotification
(String memberId, RaftRole newRole, @Nullable RaftRole oldRole) -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.memberId()
Returns the value of thememberId
record component.newRole()
Returns the value of thenewRole
record component.@Nullable String
oldRole()
Returns the value of theoldRole
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
RoleChangeNotification
Creates an instance of aRoleChangeNotification
record class.- Parameters:
memberId
- the value for thememberId
record componentoldRole
- the value for theoldRole
record componentnewRole
- the value for thenewRole
record component
-
RoleChangeNotification
-
RoleChangeNotification
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
memberId
Returns the value of thememberId
record component.- Returns:
- the value of the
memberId
record component
-
oldRole
Returns the value of theoldRole
record component.- Returns:
- the value of the
oldRole
record component
-
newRole
Returns the value of thenewRole
record component.- Returns:
- the value of the
newRole
record component
-