jgroup.core
Interface MembershipService

All Superinterfaces:
Layer, Layer.FinalizeLayer
All Known Implementing Classes:
MembershipLayer, MergingLayer

public interface MembershipService
extends Layer, Layer.FinalizeLayer

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 (Revised Jgroup 2.2)
Author:
Alberto Montresor, Hein Meling
See Also:
GroupManager

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.core.Layer
Layer.FinalizeLayer
 
Method Summary
 int getGid()
          Returns the group identifier.
 int getMemberIndex()
          Position index of this member in the array containing the local members of the current view.
 MemberTable getMemberTable()
          Returns a MemberTable helper object that will be notified of changes in the membership.
 MemberId getMyIdentifier()
          Returns the member identifier of the local member.
 int getViewIndex()
          Position index of this member in the array containing the members of the current view.
 boolean isJoining()
          Returns true if the GroupManager is in the process of joining some group.
 boolean isLeader()
          Returns true if the local member is the group leader.
 boolean isMember()
          Returns true if the GroupManager is member of some group.
 boolean isMemberOrJoining()
          Returns true if the GroupManager is member of some group or is in the process of joining some group.
 void join()
          Requests to join the default group associated with the Jgroup daemon.
 void join(int groupId)
          Requests to join a group identified by groupId.
 void leave()
          Request to leave a group.
 int members()
          Return the number of members of this group.
 
Methods inherited from interface jgroup.core.Layer
addListener
 
Methods inherited from interface jgroup.core.Layer.FinalizeLayer
complete
 

Method Detail

join

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

Parameters:
groupId - Non-negative integer identifying the group.
Throws:
java.lang.IllegalArgumentException - Raised if groupId is negative.
JgroupException - Raised if the membership service receives a request to join a group to which it is already a member.

join

void join()
          throws JgroupException
Requests to join the default group associated with the Jgroup daemon.

Each Jgroup daemon has a default group. If a Jgroup daemon does not need to be shared by multiple groups, the application servers may simply join the default group without having to specify group identifiers.

Throws:
JgroupException - Raised if the membership service receives a request to join a group to which it is already a member.

leave

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 requested to leave the group itself. However, the member will eventually leave the group. When this happens, its hasLeft method is invoked. After this invocation, the member will not receive any further event notification related to the group.

Throws:
JgroupException - Rasied if the server is not member of any group, or is already leaving its current group.

isMember

boolean isMember()
Returns true if the GroupManager is member of some group. Otherwise, false is returned.


isJoining

boolean isJoining()
Returns true if the GroupManager is in the process of joining some group. Otherwise, false is returned.


isMemberOrJoining

boolean isMemberOrJoining()
Returns true if the GroupManager is member of some group or is in the process of joining some group. Otherwise, false is returned.


isLeader

boolean isLeader()
Returns true if the local member is the group leader.


getMyIdentifier

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


getGid

int getGid()
Returns the group identifier.


getMemberTable

MemberTable getMemberTable()
Returns a MemberTable helper object that will be notified of changes in the membership. This is used to provide application developers with additional information about members of their current view.


members

int members()
Return the number of members of this group.


getViewIndex

int getViewIndex()
Position index of this member in the array containing the members of the current view.


getMemberIndex

int getMemberIndex()
Position index of this member in the array containing the local members of the current view.



Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.