Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 7.0.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.tribes.membership
Class Membership

    java.lang.Object
      org.apache.catalina.tribes.membership.Membership

All Implemented Interfaces:
  Cloneable

    public class Membership

extends Object
implements Cloneable

A membership implementation using simple multicast. This is the representation of a multicast membership. This class is responsible for maintaining a list of active cluster nodes in the cluster. If a node fails to send out a heartbeat, the node will be dismissed.

Version:
  $Id: Membership.java 1043153 2010-12-07 18:05:31Z markt $
Author:
  Filip Hanik, Peter Rossbach

Nested Class Summary
`protected static class` | `Membership.MbrEntry` Inner class that represents a member entry

Field Summary
`protected static MemberImpl[]` | `EMPTY_MEMBERS`
`protected MemberImpl` | `local` The name of this membership, has to be the same as the name for the local member
`protected HashMap<MemberImpl,Membership.MbrEntry>` | `map` A map of all the members in the cluster.
`protected Comparator<Member>` | `memberComparator` sort members by alive time
`protected MemberImpl[]` | `members` A list of all the members in the cluster.

Constructor Summary
`Membership(MemberImpl local)`
`Membership(MemberImpl local, boolean includeLocal)` Constructs a new membership
`Membership(MemberImpl local, Comparator<Member> comp)`
`Membership(MemberImpl local, Comparator<Member> comp, boolean includeLocal)`

Method Summary
`Membership.MbrEntry` | `addMember(MemberImpl member)` Add a member to this component and sort array with memberComparator
`Object` | `clone()`
`boolean` | `contains(Member mbr)`
`MemberImpl[]` | `expire(long maxtime)` Runs a refresh cycle and returns a list of members that has expired.
`MemberImpl` | `getMember(Member mbr)`
`protected Membership.MbrEntry[]` | `getMemberEntries()` get a copy from all member entries
`MemberImpl[]` | `getMembers()` Returning a list of all the members in the membership We not need a copy: add and remove generate new arrays.
`boolean` | `hasMembers()` Returning that service has members or not
`boolean` | `memberAlive(MemberImpl member)` Notify the membership that this member has announced itself.
`void` | `removeMember(MemberImpl member)` Remove a member from this component.
`void` | `reset()` Reset the membership and start over fresh.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EMPTY_MEMBERS

    protected static final MemberImpl[] EMPTY_MEMBERS

### local

    protected MemberImpl local

  The name of this membership, has to be the same as the name for the local member

### map

    protected HashMap<MemberImpl,Membership.MbrEntry> map

  A map of all the members in the cluster.

### members

    protected MemberImpl[] members

  A list of all the members in the cluster.

### memberComparator

    protected Comparator<Member> memberComparator

  sort members by alive time

Constructor Detail

### Membership

    public Membership(MemberImpl local,
                      boolean includeLocal)

  Constructs a new membership

  Parameters:
    `local` - - has to be the name of the local member. Used to filter the local member from the cluster membership
    `includeLocal` - - TBA

### Membership

    public Membership(MemberImpl local)

### Membership

    public Membership(MemberImpl local,
                      Comparator<Member> comp)

### Membership

    public Membership(MemberImpl local,
                      Comparator<Member> comp,
                      boolean includeLocal)

Method Detail

### clone

    public Object clone()

  Overrides:
    `clone` in class `Object`

### reset

    public void reset()

  Reset the membership and start over fresh. Ie, delete all the members and wait for them to ping again and join this membership

### memberAlive

    public boolean memberAlive(MemberImpl member)

  Notify the membership that this member has announced itself.

  Parameters:
    `member` - - the member that just pinged us
  Returns:
    - true if this member is new to the cluster, false otherwise.
    - false if this member is the local member or updated.

### addMember

    public Membership.MbrEntry addMember(MemberImpl member)

  Add a member to this component and sort array with memberComparator

  Parameters:
    `member` - The member to add

### removeMember

    public void removeMember(MemberImpl member)

  Remove a member from this component.

  Parameters:
    `member` - The member to remove

### expire

    public MemberImpl[] expire(long maxtime)

  Runs a refresh cycle and returns a list of members that has expired. This also removes the members from the membership, in such a way that getMembers() = getMembers() - expire()

  Parameters:
    `maxtime` - - the max time a member can remain unannounced before it is considered dead.
  Returns:
    the list of expired members

### hasMembers

    public boolean hasMembers()

  Returning that service has members or not

### getMember

    public MemberImpl getMember(Member mbr)

### contains

    public boolean contains(Member mbr)

### getMembers

    public MemberImpl[] getMembers()

  Returning a list of all the members in the membership We not need a copy: add and remove generate new arrays.

### getMemberEntries

    protected Membership.MbrEntry[] getMemberEntries()

  get a copy from all member entries

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 7.0.29
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.