public class Membership extends Object implements Cloneable
Modifier and Type | Class and Description |
---|---|
protected static class |
Membership.MbrEntry
Inner class that represents a member entry
|
Modifier and Type | Field and Description |
---|---|
protected static Member[] |
EMPTY_MEMBERS |
protected Member |
local
The local member.
|
protected HashMap<Member,Membership.MbrEntry> |
map
A map of all the members in the cluster.
|
protected Comparator<Member> |
memberComparator
Comparator for sorting members by alive time.
|
protected Member[] |
members
A list of all the members in the cluster.
|
Constructor and Description |
---|
Membership(Member local) |
Membership(Member local,
boolean includeLocal)
Constructs a new membership
|
Membership(Member local,
Comparator<Member> comp) |
Membership(Member local,
Comparator<Member> comp,
boolean includeLocal) |
Modifier and Type | Method and Description |
---|---|
Membership.MbrEntry |
addMember(Member member)
Add a member to this component and sort array with memberComparator
|
Object |
clone() |
boolean |
contains(Member mbr) |
Member[] |
expire(long maxtime)
Runs a refresh cycle and returns a list of members that has expired.
|
Member |
getMember(Member mbr) |
Member[] |
getMembers()
Returning a list of all the members in the membership.
|
boolean |
hasMembers()
Returning that service has members or not.
|
boolean |
memberAlive(Member member)
Notify the membership that this member has announced itself.
|
void |
removeMember(Member member)
Remove a member from this component.
|
void |
reset()
Reset the membership and start over fresh. i.e., delete all the members
and wait for them to ping again and join this membership.
|
protected static final Member[] EMPTY_MEMBERS
protected final Member local
protected HashMap<Member,Membership.MbrEntry> map
protected volatile Member[] members
protected final Comparator<Member> memberComparator
public Membership(Member local, boolean includeLocal)
local
- - has to be the name of the local member. Used to filter the local member from the cluster membershipincludeLocal
- - TBApublic Membership(Member local)
public Membership(Member local, Comparator<Member> comp)
public Membership(Member local, Comparator<Member> comp, boolean includeLocal)
public void reset()
public boolean memberAlive(Member member)
member
- - the member that just pinged uspublic Membership.MbrEntry addMember(Member member)
member
- The member to addpublic void removeMember(Member member)
member
- The member to removepublic Member[] expire(long maxtime)
maxtime
- - the max time a member can remain unannounced before it is considered dead.public boolean hasMembers()
true
if there are one or more members, otherwise
false
public boolean contains(Member mbr)
public Member[] getMembers()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.