McastMembership (Tomcat API Documentation)
Keywords: org.apache.catalina.cluster.mcast.McastMembership class

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

## org.apache.catalina.cluster.mcast
Class McastMembership

    java.lang.Object
      org.apache.catalina.cluster.mcast.McastMembership

public class McastMembership
extends java.lang.Object

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: McastMembership.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
  Filip Hanik, Peter Rossbach

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

Field Summary
`protected static McastMember[]` | `EMPTY_MEMBERS`
`protected java.util.Map` | `map` A map of all the members in the cluster.
`protected org.apache.catalina.cluster.mcast.McastMembership.MemberComparator` | `memberComparator` sort members by alive time
`protected McastMember[]` | `members` A list of all the members in the cluster.
`protected java.lang.String` | `name` The name of this membership, has to be the same as the name for the local member

Constructor Summary
`McastMembership(java.lang.String name)` Constructs a new membership

Method Summary
`protected void` | `addMcastMember(McastMember member)` Add a member to this component and sort array with memberComparator
`McastMember[]` | `expire(long maxtime)` Runs a refresh cycle and returns a list of members that has expired.
`protected McastMembership.MbrEntry[]` | `getMemberEntries()` get a copy from all member entries
`McastMember[]` | `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(McastMember member)` Notify the membership that this member has announced itself.
`protected void` | `removeMcastMember(McastMember member)` Remove a member from this component.
`void` | `reset()` Reset the membership and start over fresh.

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

Field Detail

### EMPTY_MEMBERS

    protected static final McastMember[] EMPTY_MEMBERS

### name

    protected java.lang.String name

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

### map

    protected java.util.Map map

  A map of all the members in the cluster.

### members

    protected McastMember[] members

  A list of all the members in the cluster.

### memberComparator

    protected org.apache.catalina.cluster.mcast.McastMembership.MemberComparator memberComparator

  sort members by alive time

Constructor Detail

### McastMembership

    public McastMembership(java.lang.String name)

  Constructs a new membership

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

Method Detail

### 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(McastMember 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.

### addMcastMember

    protected void addMcastMember(McastMember member)

  Add a member to this component and sort array with memberComparator

  Parameters:
    `member` - The member to add

### removeMcastMember

    protected void removeMcastMember(McastMember member)

  Remove a member from this component.

  Parameters:
    `member` - The member to remove

### expire

    public McastMember[] 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

### getMembers

    public McastMember[] getMembers()

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

### getMemberEntries

    protected McastMembership.MbrEntry[] getMemberEntries()

  get a copy from all member entries

Overview | Package | Class | Tree | Deprecated | Index | Help
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.