jgroup.core
Interface View

All Superinterfaces:
java.lang.Cloneable, java.io.Externalizable, java.io.Serializable
All Known Implementing Classes:
ViewImpl

public interface View
extends java.io.Externalizable, java.lang.Cloneable

The Partitionable Group Membership Service contained in Jgroup tracks changes in the group's composition and installs them as views at member objects. Installated views are an abstraction of the current environment with respect to failures and recoveries. Member objects can obtain information about the current view through the View interface. Each view is uniquely identified by a view identifier, that can be obtained by invoking method getVid. The composition of the view may be obtained by invoking method getMembers.

Since:
Jgroup 0.1
Author:
Alberto Montresor, Hein Meling

Method Summary
 java.lang.Object clone()
           
 MemberId[] commonMembers(MemberId[] members)
          Returns an array of MemberIds that are common to this view and the provided member array.
 MemberId[] commonMembers(View view)
          Returns an array of MemberIds that are common to this view and the provided view.
 boolean contains(MemberId memberId)
          Returns true if the given member is contained in the current view.
 boolean containsAll(View view)
          Returns true if this view contains all members of the provided view.
 int getGid()
          Returns the identifier of the group for which this view has been generated.
 MemberId getLeader()
          Return the MemberId of the group leader (member in position 0).
 int getMemberPosition(MemberId id)
          Returns the position of the given member in this view.
 MemberId[] getMembers()
          Returns an array of MemberIds identifying the members included in this view.
 long getVid()
          Returns the identifier of this view.
 boolean hasSameMembers(View prevView)
          Returns true if this view has exactly the same members are the provided view.
 boolean isLeader(MemberId member)
          Returns true if the given member is the group leader.
 boolean memberHasPosition(int pos, MemberId member)
          Returns true if the specified member is the member at the given position; otherwise false is returned.
 int mergingViews()
          Returns the number of views (or partitions) merging into this view.
 MemberId[] newMembers(View previousView)
          Returns an array of MemberIds that are new to this view; that is they were not in the previous view.
 MemberId[] oldMembers(View previousView)
          Returns an array of MemberIds that are not longer part of this view; that is they were members of the previous view but are no longer members of the this view.
 int size()
          Returns the number of members in this view.
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Method Detail

getGid

int getGid()
Returns the identifier of the group for which this view has been generated.


getVid

long getVid()
Returns the identifier of this view.


mergingViews

int mergingViews()
Returns the number of views (or partitions) merging into this view.


getMembers

MemberId[] getMembers()
Returns an array of MemberIds identifying the members included in this view.


getLeader

MemberId getLeader()
Return the MemberId of the group leader (member in position 0).


isLeader

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


commonMembers

MemberId[] commonMembers(MemberId[] members)
Returns an array of MemberIds that are common to this view and the provided member array.


commonMembers

MemberId[] commonMembers(View view)
Returns an array of MemberIds that are common to this view and the provided view.


newMembers

MemberId[] newMembers(View previousView)
Returns an array of MemberIds that are new to this view; that is they were not in the previous view.


oldMembers

MemberId[] oldMembers(View previousView)
Returns an array of MemberIds that are not longer part of this view; that is they were members of the previous view but are no longer members of the this view.


contains

boolean contains(MemberId memberId)
Returns true if the given member is contained in the current view. Otherwise, false is returned.


containsAll

boolean containsAll(View view)
Returns true if this view contains all members of the provided view. False is returned otherwise.

This is useful for checking if a new view is a contraction of the previous view, or if there are new members.


hasSameMembers

boolean hasSameMembers(View prevView)
Returns true if this view has exactly the same members are the provided view. False is returned otherwise.

Note that this is different from using Object.equals(), since this method will not check that the view identifiers are the same.


size

int size()
Returns the number of members in this view.


getMemberPosition

int getMemberPosition(MemberId id)
Returns the position of the given member in this view. If the member is not in this view, a negative value is returned.


memberHasPosition

boolean memberHasPosition(int pos,
                          MemberId member)
Returns true if the specified member is the member at the given position; otherwise false is returned.

Parameters:
pos - The position in the view to check for equality with the given member. A negative position value is considered to indicate a position from the end of the view array, while a positive value indicate a position from the beginning of the view array. A position value outside the range of the view, will always return false.
member - The member whose position to check.
Returns:
True if the given member is at the specified position in this view; false otherwise.

clone

java.lang.Object clone()


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