Class GMS.DefaultMembershipPolicy

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<Address> getNewMembership​(java.util.Collection<java.util.Collection<Address>> subviews)
      Default implementation for a merge.
      java.util.List<Address> getNewMembership​(java.util.Collection<Address> current_members, java.util.Collection<Address> joiners, java.util.Collection<Address> leavers, java.util.Collection<Address> suspects)
      Takes the existing membership list and removes suspected and left members, then adds new members to the end of the list
      static java.util.List<Address> getNewMembershipOld​(java.util.Collection<java.util.Collection<Address>> subviews)
      Old default implementation for a merge.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultMembershipPolicy

        public DefaultMembershipPolicy()
    • Method Detail

      • getNewMembership

        public java.util.List<Address> getNewMembership​(java.util.Collection<Address> current_members,
                                                        java.util.Collection<Address> joiners,
                                                        java.util.Collection<Address> leavers,
                                                        java.util.Collection<Address> suspects)
        Takes the existing membership list and removes suspected and left members, then adds new members to the end of the list
        Specified by:
        getNewMembership in interface MembershipChangePolicy
        Parameters:
        current_members - The list of current members. Guaranteed to be non-null (but may be empty)
        joiners - The joining members. Guaranteed to be non-null (but may be empty)
        leavers - Members that are leaving. Guaranteed to be non-null (but may be empty)
        suspects - Members which are suspected. Guaranteed to be non-null (but may be empty)
        Returns:
        The new membership. Needs to be non-null and cannot contain duplicates
      • getNewMembershipOld

        public static java.util.List<Address> getNewMembershipOld​(java.util.Collection<java.util.Collection<Address>> subviews)
        Old default implementation for a merge. Adds all members into a list, sorts the list and returns it
        Parameters:
        subviews - A list of membership lists, e.g. [{A,B,C}, {M,N,O,P}, {X,Y,Z}]. This is a merge between 3 subviews. Guaranteed to be non-null (but may be empty)
        Returns:
        The new membership. Needs to be non-null and cannot contain duplicates
      • getNewMembership

        public java.util.List<Address> getNewMembership​(java.util.Collection<java.util.Collection<Address>> subviews)
        Default implementation for a merge. Picks the new coordinator among the coordinators of the old subviews by getting all coords, sorting them and picking the first. Then the coord is added to the new list, and all subviews are subsequently added.

        Tries to minimize coordinatorship moving around between different members

        Specified by:
        getNewMembership in interface MembershipChangePolicy
        Parameters:
        subviews - A list of membership lists, e.g. [{A,B,C}, {M,N,O,P}, {X,Y,Z}]. This is a merge between 3 subviews. Guaranteed to be non-null (but may be empty)
        Returns:
        The new membership. Needs to be non-null and cannot contain duplicates