Package akka.cluster
Class Member
- java.lang.Object
-
- akka.cluster.Member
-
- All Implemented Interfaces:
java.io.Serializable
public class Member extends java.lang.Object implements java.io.Serializable
Represents the address, current status, and roles of a cluster member node.Note:
hashCode
andequals
are solely based on the underlyingAddress
, not itsMemberStatus
and roles.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Address
address()
static scala.math.Ordering<Address>
addressOrdering()
Address
ordering type class, sorts addresses by host and port.static scala.math.Ordering<Member>
ageOrdering()
Sort members by age, i.e.Version
appVersion()
Member
copy(MemberStatus status)
Member
copyUp(int upNumber)
java.lang.String
dataCenter()
boolean
equals(java.lang.Object other)
java.util.Set<java.lang.String>
getRoles()
Java APIint
hashCode()
boolean
hasRole(java.lang.String role)
static Member
highestPriorityOf(Member m1, Member m2)
Picks the Member with the highest "priority" MemberStatus.boolean
isOlderThan(Member other)
Is this member older, has been part of cluster longer, than another member.static scala.collection.immutable.Set<Member>
none()
static scala.math.Ordering<Member>
ordering()
Member
ordering type class, sorts members by host and port.scala.collection.immutable.Set<java.lang.String>
roles()
MemberStatus
status()
java.lang.String
toString()
UniqueAddress
uniqueAddress()
-
-
-
Method Detail
-
none
public static scala.collection.immutable.Set<Member> none()
-
addressOrdering
public static scala.math.Ordering<Address> addressOrdering()
Address
ordering type class, sorts addresses by host and port.
-
ordering
public static scala.math.Ordering<Member> ordering()
Member
ordering type class, sorts members by host and port.
-
ageOrdering
public static scala.math.Ordering<Member> ageOrdering()
Sort members by age, i.e. usingisOlderThan(akka.cluster.Member)
.Note that it only makes sense to compare with other members of same data center. To avoid mistakes of comparing members of different data centers it will throw
IllegalArgumentException
if the members belong to different data centers.
-
highestPriorityOf
public static Member highestPriorityOf(Member m1, Member m2)
Picks the Member with the highest "priority" MemberStatus. Where highest priority is furthest along the membership state machine
-
uniqueAddress
public UniqueAddress uniqueAddress()
-
status
public MemberStatus status()
-
roles
public scala.collection.immutable.Set<java.lang.String> roles()
-
appVersion
public Version appVersion()
-
dataCenter
public java.lang.String dataCenter()
-
address
public Address address()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hasRole
public boolean hasRole(java.lang.String role)
-
getRoles
public java.util.Set<java.lang.String> getRoles()
Java API
-
isOlderThan
public boolean isOlderThan(Member other) throws java.lang.IllegalArgumentException
Is this member older, has been part of cluster longer, than another member. It is only correct when comparing two existing members in a cluster. A member that joined after removal of another member may be considered older than the removed member.Note that it only makes sense to compare with other members of same data center (upNumber has a higher risk of being reused across data centers). To avoid mistakes of comparing members of different data centers this method will throw
IllegalArgumentException
if the members belong to different data centers.- Throws:
java.lang.IllegalArgumentException
-
copy
public Member copy(MemberStatus status)
-
copyUp
public Member copyUp(int upNumber)
-
-