JavaGroups.JavaStack.Protocols
Class GMS

java.lang.Object
  |
  +--JavaGroups.JavaStack.Protocol
        |
        +--JavaGroups.JavaStack.MessageProtocol
              |
              +--JavaGroups.JavaStack.RpcProtocol
                    |
                    +--JavaGroups.JavaStack.Protocols.GMS

public class GMS
extends RpcProtocol
implements java.lang.Runnable

Group membership protocol. Handles joins/leaves/crashes (suspicions) and emits new views accordingly. Use VIEW_ENFORCER on top of this layer to make sure new members don't receive any messages until they are members.


Field Summary
 java.lang.String group_addr
           
 java.lang.Object impl_mutex
           
 long initial_mbrs_timeout
           
 long join_retry_timeout
           
 long join_timeout
           
 long leave_timeout
           
 Address local_addr
           
 long ltime
           
 Membership members
           
 java.util.Properties props
           
 boolean trace
           
 ViewId view_id
           
 java.lang.Object view_mutex
           
 
Constructor Summary
GMS()
           
 
Method Summary
 void CastViewChange(java.util.Vector new_mbrs, java.util.Vector old_mbrs, java.util.Vector suspected_mbrs)
          Compute a new view, given the current view, the new members and the suspected/left members.
 java.lang.String GetName()
           
 View GetNextView(java.util.Vector new_mbrs, java.util.Vector old_mbrs, java.util.Vector suspected_mbrs)
          Computes the next view.
 boolean HandleDownEvent(Event evt)
          Callback.
 boolean HandleJoin(Address mbr)
           
 void HandleLeave(Address mbr, boolean suspected)
           
 void HandleMerge(java.util.Vector new_mbrs, java.util.Vector suspects, long other_ltime)
           
 void HandleSuspect(Address mbr)
           
 boolean HandleUpEvent(Event evt)
          Callback.
 void HandleViewChange(ViewId new_view, java.util.Vector mbrs)
           
 void InstallView(ViewId new_view, java.util.Vector mbrs)
          Assigns the new ltime.
 void Join(Address mbr)
           
 void Leave(Address mbr)
           
 View MakeView(java.util.Vector mbrs)
           
 View MakeView(java.util.Vector mbrs, ViewId vid)
           
 void Merge(java.util.Vector new_mbrs)
           
 void ReceiveDownEvent(Event evt)
           
 java.util.Vector RequiredDownServices()
          List of events that are required to be answered by some layer below.
 void run()
           
 void SetImpl(GmsImpl new_impl)
           
 boolean SetProperties(java.util.Properties props)
          Setup the Protocol instance acording to the configuration string
 void Suspect(Address mbr)
           
 
Methods inherited from class JavaGroups.JavaStack.RpcProtocol
CallRemoteMethod, CallRemoteMethod, CallRemoteMethod, CallRemoteMethod, CallRemoteMethod, CallRemoteMethod, CallRemoteMethod, CallRemoteMethods, CallRemoteMethods, CallRemoteMethods, CallRemoteMethods, CallRemoteMethods, CallRemoteMethods, CallRemoteMethods, Handle
 
Methods inherited from class JavaGroups.JavaStack.MessageProtocol
CastMessage, Down, SendMessage, Up
 
Methods inherited from class JavaGroups.JavaStack.Protocol
GetDownProtocol, GetProperties, GetUpProtocol, PassDown, PassUp, ProvidedDownServices, ProvidedUpServices, RequiredUpServices, Reset, SetDownProtocol, SetProtocolStack, SetUpProtocol, StartDownHandler, StartUpHandler, StopInternal
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

props

public java.util.Properties props

local_addr

public Address local_addr

group_addr

public java.lang.String group_addr

members

public Membership members

view_id

public ViewId view_id

ltime

public long ltime

initial_mbrs_timeout

public long initial_mbrs_timeout

join_timeout

public long join_timeout

join_retry_timeout

public long join_retry_timeout

leave_timeout

public long leave_timeout

trace

public boolean trace

impl_mutex

public java.lang.Object impl_mutex

view_mutex

public java.lang.Object view_mutex
Constructor Detail

GMS

public GMS()
Method Detail

GetName

public java.lang.String GetName()
Overrides:
GetName in class RpcProtocol

RequiredDownServices

public java.util.Vector RequiredDownServices()
Description copied from class: Protocol
List of events that are required to be answered by some layer below.
Overrides:
RequiredDownServices in class Protocol
Tags copied from class: Protocol
Returns:
Vector (of Integers)

SetImpl

public void SetImpl(GmsImpl new_impl)

GetNextView

public View GetNextView(java.util.Vector new_mbrs,
                        java.util.Vector old_mbrs,
                        java.util.Vector suspected_mbrs)
Computes the next view. Returns a copy that has old_mbrs and suspected_mbrs removed and new_mbrs added.

CastViewChange

public void CastViewChange(java.util.Vector new_mbrs,
                           java.util.Vector old_mbrs,
                           java.util.Vector suspected_mbrs)
Compute a new view, given the current view, the new members and the suspected/left members. Run view update protocol to install a new view in all members (this involves casting the new view to all members). The targets for FLUSH and VIEW mcasts are computed as follows:

G is the current membership, N is the set of new members, L is the set of leaving members, S is the set of suspected members. The FLUSH mcast is sent to G minus S (including L). The VIEW mcast is sent to G plus N minus S (all existing members, plus the new member, excluding suspected members).


InstallView

public void InstallView(ViewId new_view,
                        java.util.Vector mbrs)
Assigns the new ltime. Installs view and view_id. Changes role to coordinator if necessary. Sends VIEW_CHANGE event up and down the stack.

MakeView

public View MakeView(java.util.Vector mbrs)

MakeView

public View MakeView(java.util.Vector mbrs,
                     ViewId vid)

Join

public void Join(Address mbr)

Leave

public void Leave(Address mbr)

Suspect

public void Suspect(Address mbr)

Merge

public void Merge(java.util.Vector new_mbrs)

HandleJoin

public boolean HandleJoin(Address mbr)

HandleLeave

public void HandleLeave(Address mbr,
                        boolean suspected)

HandleViewChange

public void HandleViewChange(ViewId new_view,
                             java.util.Vector mbrs)

HandleMerge

public void HandleMerge(java.util.Vector new_mbrs,
                        java.util.Vector suspects,
                        long other_ltime)

HandleSuspect

public void HandleSuspect(Address mbr)

HandleUpEvent

public boolean HandleUpEvent(Event evt)
Callback. Called by superclass when event may be handled.

Do not use PassUp in this method as the event is passed up by default by the superclass after this method returns !

Overrides:
HandleUpEvent in class RpcProtocol
Returns:
boolean Defaults to true. If false, event will not be passed up the stack.

HandleDownEvent

public boolean HandleDownEvent(Event evt)
Callback. Called by superclass when event may be handled.

Do not use PassDown in this method as the event is passed down by default by the superclass after this method returns !

Overrides:
HandleDownEvent in class RpcProtocol
Returns:
boolean Defaults to true. If false, event will not be passed down the stack.

ReceiveDownEvent

public void ReceiveDownEvent(Event evt)

SetProperties

public boolean SetProperties(java.util.Properties props)
Setup the Protocol instance acording to the configuration string
Overrides:
SetProperties in class Protocol

run

public void run()
Specified by:
run in interface java.lang.Runnable