Class Membership
java.lang.Object
org.jgroups.Membership
- All Implemented Interfaces:
Cloneable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPublic constructor Creates a member ship object with zero membersMembership(Collection<Address> initial_members) Creates a member ship object with the initial members. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(Collection<Address> v) Adds a list of members to this membershipvoidAdds a new member to this membership.voidclear()removes all the members from this membershipclone()booleanReturns true if the provided member belongs to this membershipcopy()returns a copy of this membershipelementAt(int index) Returns the component at the specified indexreturns a copy (clone) of the members in this membership.voidmerge(Collection<Address> new_mems, Collection<Address> suspects) merges membership with the new members and removes suspects The Merge method will remove all the suspects and add in the new members.voidremove(Collection<Address> v) removes all the members contained in v from this membershipvoidremoves an member from the membership.voidset(Collection<Address> v) Clear the membership and adds all members of v This method will clear out all the old members of this membership by invoking theClearmethod.voidset(Membership m) Clear the membership and adds all members of v This method will clear out all the old members of this membership by invoking theClearmethod.intsize()Returns the number of addresses in this membershipvoidsort()toString()
-
Field Details
-
log
protected static final org.apache.commons.logging.Log log
-
-
Constructor Details
-
Membership
public Membership()Public constructor Creates a member ship object with zero members -
Membership
Creates a member ship object with the initial members. The Address references are copied out of the vector, so that the vector passed in as parameters is not the same reference as the vector that the membership class is using- Parameters:
initial_members- - a list of members that belong to this membership
-
-
Method Details
-
getMembers
-
add
Adds a new member to this membership. If the member already exist (Address.equals(Object) returns true then the member will not be added to the membership -
add
Adds a list of members to this membership- Parameters:
v- - a vector containing Address objects- Throws:
ClassCastException- if v contains objects that don't implement the Address interface- See Also:
-
remove
removes an member from the membership. If this member doesn't exist, no action will be performed on the existing membership- Parameters:
old_member- - the member to be removed
-
remove
removes all the members contained in v from this membership- Parameters:
v- - a vector containing all the members to be removed
-
clear
public void clear()removes all the members from this membership -
set
Clear the membership and adds all members of v This method will clear out all the old members of this membership by invoking theClearmethod. Then it will add all the all members provided in the vector v- Parameters:
v- - a vector containing all the members this membership will contain
-
set
Clear the membership and adds all members of v This method will clear out all the old members of this membership by invoking theClearmethod. Then it will add all the all members provided in the vector v- Parameters:
m- - a membership containing all the members this membership will contain
-
merge
merges membership with the new members and removes suspects The Merge method will remove all the suspects and add in the new members. It will do it in the order 1. Remove suspects 2. Add new members the order is very important to notice.- Parameters:
new_mems- - a vector containing a list of members (Address) to be added to this membershipsuspects- - a vector containing a list of members (Address) to be removed from this membership
-
contains
Returns true if the provided member belongs to this membership- Parameters:
member-- Returns:
- true if the member belongs to this membership
-
sort
public void sort() -
copy
returns a copy of this membership- Returns:
- an exact copy of this membership
-
clone
-
size
public int size()Returns the number of addresses in this membership- Returns:
- the number of addresses in this membership
-
elementAt
Returns the component at the specified index- Parameters:
index- - 0..size()-1- Throws:
ArrayIndexOutOfBoundsException- - if the index is negative or not less than the current size of this Membership object.- See Also:
-
toString
-