| |
|
| java.lang.Object org.jgroups.Membership
Membership | public class Membership implements Cloneable(Code) | | Class to keep track of Addresses.
The membership object holds a vector of Address objects that are in the same membership.
Each unique address can only exist once; i.e., doing Membership.add(existing_address)
will be ignored.
|
Field Summary | |
final protected static Log | log |
Method Summary | |
public void | add(Address new_member) Adds a new member to this membership. | final public void | add(Collection v) | public void | clear() | public Object | clone() a clone of this object. | public boolean | contains(Address member) | public Membership | copy() | public Object | elementAt(int index) | public Vector | getMembers() returns a copy (clone) of the members in this membership. | public void | merge(Collection new_mems, Collection suspects) 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. | public void | remove(Address old_member) removes an member from the membership. | public void | remove(Collection v) | public void | set(Collection v) Clear the membership and adds all members of v
This method will clear out all the old members of this membership by
invoking the Clear method. | public void | set(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 the Clear method. | public int | size() | public void | sort() | public String | toString() |
log | final protected static Log log(Code) | | |
Membership | public Membership()(Code) | | Public constructor
Creates a member ship object with zero members
|
Membership | public Membership(Collection initial_members)(Code) | | 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 |
add | public void add(Address new_member)(Code) | | 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 | final public void add(Collection v)(Code) | | 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: Membership.add |
clear | public void clear()(Code) | | removes all the members from this membership
|
clone | public Object clone()(Code) | | a clone of this object. The list of members is copied to a newcontainer |
contains | public boolean contains(Address member)(Code) | | Returns true if the provided member belongs to this membership
Parameters: member - true if the member belongs to this membership |
copy | public Membership copy()(Code) | | returns a copy of this membership
an exact copy of this membership |
getMembers | public Vector getMembers()(Code) | | returns a copy (clone) of the members in this membership.
the vector returned is immutable in reference to this object.
ie, modifying the vector that is being returned in this method
will not modify this membership object.
a list of members, |
merge | public void merge(Collection new_mems, Collection suspects)(Code) | | 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 membership Parameters: suspects - - a vector containing a list of members (Address) to be removed from this membership |
remove | public void remove(Address old_member)(Code) | | 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 | public void remove(Collection v)(Code) | | removes all the members contained in v from this membership
Parameters: v - - a vector containing all the members to be removed |
set | public void set(Collection v)(Code) | | Clear the membership and adds all members of v
This method will clear out all the old members of this membership by
invoking the Clear method.
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 | public void set(Membership m)(Code) | | Clear the membership and adds all members of v
This method will clear out all the old members of this membership by
invoking the Clear method.
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 |
size | public int size()(Code) | | Returns the number of addresses in this membership
the number of addresses in this membership |
|
|
|