Package akka.cluster

Class Member

  • All Implemented Interfaces:
    java.io.Serializable, scala.Serializable

    public class Member
    extends java.lang.Object
    implements scala.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
    • Constructor Detail

      • Member

        public Member​(UniqueAddress uniqueAddress,
                      int upNumber,
                      MemberStatus status,
                      scala.collection.immutable.Set<java.lang.String> roles)
    • Method Detail

      • none

        public static scala.collection.immutable.Set<Member> none()
      • apply

        public static Member apply​(UniqueAddress uniqueAddress,
                                   scala.collection.immutable.Set<java.lang.String> roles)
        INTERNAL API Create a new member with status Joining.
        Parameters:
        uniqueAddress - (undocumented)
        roles - (undocumented)
        Returns:
        (undocumented)
      • removed

        public static Member removed​(UniqueAddress node)
        INTERNAL API
        Parameters:
        node - (undocumented)
        Returns:
        (undocumented)
      • addressOrdering

        public static scala.math.Ordering<Address> addressOrdering()
        Address ordering type class, sorts addresses by host and port.
        Returns:
        (undocumented)
      • leaderStatusOrdering

        public static scala.math.Ordering<Member> leaderStatusOrdering()
        INTERNAL API Orders the members by their address except that members with status Joining, Exiting and Down are ordered last (in that order).
        Returns:
        (undocumented)
      • ordering

        public static scala.math.Ordering<Member> ordering()
        Member ordering type class, sorts members by host and port.
        Returns:
        (undocumented)
      • 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.

        Returns:
        (undocumented)
      • pickHighestPriority

        public static scala.collection.immutable.Set<Member> pickHighestPriority​(scala.collection.immutable.Set<Member> a,
                                                                                 scala.collection.immutable.Set<Member> b)
        Deprecated.
        Was accidentally made a public API, internal. Since 2.5.4.
      • pickHighestPriority

        public static scala.collection.immutable.Set<Member> pickHighestPriority​(scala.collection.immutable.Set<Member> a,
                                                                                 scala.collection.immutable.Set<Member> b,
                                                                                 scala.collection.immutable.Map<UniqueAddress,​java.lang.Object> tombstones)
        INTERNAL API.
        Parameters:
        a - (undocumented)
        b - (undocumented)
        tombstones - (undocumented)
        Returns:
        (undocumented)
      • highestPriorityOf

        public static Member highestPriorityOf​(Member m1,
                                               Member m2)
        Picks the Member with the highest "priority" MemberStatus.
        Parameters:
        m1 - (undocumented)
        m2 - (undocumented)
        Returns:
        (undocumented)
      • upNumber

        public int upNumber()
      • roles

        public scala.collection.immutable.Set<java.lang.String> roles()
      • 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
        Returns:
        (undocumented)
      • 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.

        Parameters:
        other - (undocumented)
        Returns:
        (undocumented)
        Throws:
        java.lang.IllegalArgumentException
      • copyUp

        public Member copyUp​(int upNumber)