Package akka.cluster

Class 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 and equals are solely based on the underlying Address, not its MemberStatus and roles.

    See Also:
    Serialized Form
    • 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. using isOlderThan(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
      • 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 class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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
      • copyUp

        public Member copyUp​(int upNumber)