jgroup
Interface MembershipService


public interface MembershipService

The facilities provided by the group membership service included in Jgroup may be accessed using the MembershipService interface. Methods in this interfaces enable objects to become members of a group and subsequentially leave it.

Instances of MembershipService may be obtained through the GroupManager class.

Since:
Jgroup 0.1
Author:
Alberto Montresor

Method Summary
 MemberTable getMemberTable()
          Returns a MemberTable helper that will notified by the object.
 MemberId getMyIdentifier()
          Returns the member identifier of the member.
 void join()
          Requests to join the default group.
 void join(int gid)
          Requests to join a group identified by gid.
 void leave()
          Request to leave a group.
 

Method Detail

join

public void join(int gid)
          throws JgroupException
Requests to join a group identified by gid.

When requesting a group manager, a server may specify a port number to be used through a jgroup.TransportConfig object. Each specified port number in a Java virtual machine is controlled by a transport layer. Multiple objects joining different groups may share the facilities provided by a single transport layer by using the same communication port when requesting a group manager. In this case, the group identifier is used to distinguish multiple groups.

Parameters:
gid - Non-negative integer identifying the group
Throws:
java.lang.IllegalArgumentException - If gid is negative.
JgroupException - if the group manager receives a request to join a group for which it is already member.

join

public void join()
          throws JgroupException
Requests to join the default group.

When each group is associated to a distinct communication port, servers may join a group using a default group identifier.

Throws:
JgroupException - if the group manager receives a request to join a group for which it is already member.

leave

public void leave()
           throws JgroupException
Request to leave a group. Note that an object member may receive event notifications such as view installations for a group even after having request to leave the group itself. However, the member will eventually leave the group. When this happens, its method leaved is invoked. After this invocation, the member will not receive any event notification related to the group.
Throws:
JgroupException - If the group manager is not member of any group, or is already leaving its current group.

getMyIdentifier

public MemberId getMyIdentifier()
Returns the member identifier of the member.

getMemberTable

public MemberTable getMemberTable()
Returns a MemberTable helper that will notified by the object.