org.jgroups.protocols.pbcast
Class ClientGmsImpl

java.lang.Object
  extended by org.jgroups.protocols.pbcast.GmsImpl
      extended by org.jgroups.protocols.pbcast.ClientGmsImpl

public class ClientGmsImpl
extends GmsImpl

Client part of GMS. Whenever a new member wants to join a group, it starts in the CLIENT role. No multicasts to the group will be received and processed until the member has been joined and turned into a SERVER (either coordinator or participant, mostly just participant). This class only implements Join (called by clients who want to join a certain group, and ViewChange which is called by the coordinator that was contacted by this client, to tell the client what its initial membership is.

Version:
$Revision: 1.34.2.2 $
Author:
Bela Ban

Field Summary
 
Fields inherited from class org.jgroups.protocols.pbcast.GmsImpl
gms, log
 
Constructor Summary
ClientGmsImpl(GMS g)
           
 
Method Summary
 void handleJoinResponse(JoinRsp join_rsp)
           
 void handleLeaveResponse()
           
 void handleMembershipChange(java.util.Collection newMembers, java.util.Collection leavingMembers, java.util.Collection suspectedMembers)
           
 boolean handleUpEvent(Event evt)
          Returns immediately.
 void handleViewChange(View new_view, Digest digest)
          Does nothing.
 void init()
           
 void join(Address mbr)
          Joins this process to a group.
 void leave(Address mbr)
           
 void suspect(Address mbr)
           
 void unsuspect(Address mbr)
           
 
Methods inherited from class org.jgroups.protocols.pbcast.GmsImpl
handleExit, handleMergeCancelled, handleMergeRequest, handleMergeResponse, handleMergeView, iWouldBeCoordinator, merge, sendMergeRejectedResponse, start, stop, wrongMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientGmsImpl

public ClientGmsImpl(GMS g)
Method Detail

init

public void init()
          throws java.lang.Exception
Overrides:
init in class GmsImpl
Throws:
java.lang.Exception

join

public void join(Address mbr)
Joins this process to a group. Determines the coordinator and sends a unicast handleJoin() message to it. The coordinator returns a JoinRsp and then broadcasts the new view, which contains a message digest and the current membership (including the joiner). The joiner is then supposed to install the new view and the digest and starts accepting mcast messages. Previous mcast messages were discarded (this is done in PBCAST).

If successful, impl is changed to an instance of ParticipantGmsImpl. Otherwise, we continue trying to send join() messages to the coordinator, until we succeed (or there is no member in the group. In this case, we create our own singleton group).

When GMS.disable_initial_coord is set to true, then we won't become coordinator on receiving an initial membership of 0, but instead will retry (forever) until we get an initial membership of > 0.

Specified by:
join in class GmsImpl
Parameters:
mbr - Our own address (assigned through SET_LOCAL_ADDRESS)

leave

public void leave(Address mbr)
Specified by:
leave in class GmsImpl

handleJoinResponse

public void handleJoinResponse(JoinRsp join_rsp)
Specified by:
handleJoinResponse in class GmsImpl

handleLeaveResponse

public void handleLeaveResponse()
Specified by:
handleLeaveResponse in class GmsImpl

suspect

public void suspect(Address mbr)
Specified by:
suspect in class GmsImpl

unsuspect

public void unsuspect(Address mbr)
Specified by:
unsuspect in class GmsImpl

handleMembershipChange

public void handleMembershipChange(java.util.Collection newMembers,
                                   java.util.Collection leavingMembers,
                                   java.util.Collection suspectedMembers)
Specified by:
handleMembershipChange in class GmsImpl

handleViewChange

public void handleViewChange(View new_view,
                             Digest digest)
Does nothing. Discards all views while still client.

Specified by:
handleViewChange in class GmsImpl

handleUpEvent

public boolean handleUpEvent(Event evt)
Returns immediately. Clients don't handle suspect() requests

Overrides:
handleUpEvent in class GmsImpl


Copyright ? 1998-2006 Bela Ban. All Rights Reserved.