org.apache.catalina.cluster.mcast
Class McastMembership

java.lang.Object
  extended byorg.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:
$Revision: 1.6 $, $Date: 2004/07/01 09:44:26 $
Author:
Filip Hanik

Nested Class Summary
protected static class McastMembership.MbrEntry
          Inner class that represents a member entry
 
Field Summary
protected  java.util.HashMap map
          A map 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 myName)
          Constructs a new membership
 
Method Summary
 McastMember[] expire(long maxtime)
          Runs a refresh cycle and returns a list of members that has expired.
protected  McastMembership.MbrEntry[] getMemberEntries()
           
 McastMember[] getMembers()
          Returning a list of all the members in the membership
 boolean memberAlive(McastMember m)
          Notify the membership that this member has announced itself.
 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

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.HashMap map
A map of all the members in the cluster.

Constructor Detail

McastMembership

public McastMembership(java.lang.String myName)
Constructs a new membership

Parameters:
myName - - 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 m)
Notify the membership that this member has announced itself.

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

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

getMembers

public McastMember[] getMembers()
Returning a list of all the members in the membership


getMemberEntries

protected McastMembership.MbrEntry[] getMemberEntries()


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