public class Membership
extends java.lang.Object
implements java.lang.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 java.util.HashMap<Member,Membership.MbrEntry> |
map
A map of all the members in the cluster.
|
protected java.util.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,
java.util.Comparator<Member> comp) |
Membership(Member local,
java.util.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
|
java.lang.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) |
protected Membership.MbrEntry[] |
getMemberEntries()
Deprecated.
Unused. Will be removed in Tomcat 8.5.x.
|
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 java.util.HashMap<Member,Membership.MbrEntry> map
protected volatile Member[] members
protected final java.util.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 java.lang.Object clone()
clone
in class java.lang.Object
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()
@Deprecated protected Membership.MbrEntry[] getMemberEntries()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.