org.jgroups
Class View
- Cloneable, Externalizable
public class View
extends java.lang.Object
implements Externalizable, Cloneable
A view is a local representation of the current membership of a group
Only one view is installed in a channel at a time
Views contain the address of its creator, an ID and a list of member addresses
These adresses are ordered, and the first address is always the coordinator of the view
This way, each member of the group knows who the new coordinator will be if the current one
crashes or leaves the group.
The views are sent between members using the VIEW_CHANGE event.
protected Vector | members - A list containing all the members of the view
This list is always ordered, with the coordinator being the first member.
|
protected ViewId | vid
|
View() - creates an empty view, should not be used
|
View(Address creator, long id, Vector members) - Creates a new view
|
View(ViewId vid, Vector members) - Creates a new view
|
Object | clone() - creates a copy of this view
|
boolean | containsMember(Address mbr) - returns true, if this view contains a certain member
|
Address | getCreator() - returns the creator of this view
if this view was created with the empty constructur, null will be returned
|
Vector | getMembers() - Returns a reference to the List of members (ordered)
Do NOT change this list, hence your will invalidate the view
Make a copy if you have to modify it.
|
ViewId | getVid() - returns the view ID of this view
if this view was created with the empty constructur, null will be returned
|
String | printDetails() - debug only
|
void | readExternal(ObjectInput in)
|
int | size() - returns the number of members in this view
|
String | toString()
|
void | writeExternal(ObjectOutput out)
|
members
protected Vector members
A list containing all the members of the view
This list is always ordered, with the coordinator being the first member.
the second member will be the new coordinator if the current one disappears
or leaves the group.
View
public View()
creates an empty view, should not be used
View
public View(Address creator,
long id,
Vector members)
Creates a new view
creator
- The creator of this view (can not be null)id
- The lamport timestamp of this viewmembers
- Contains a list of all the members in the view, can be empty but not null.
View
public View(ViewId vid,
Vector members)
Creates a new view
vid
- The view id of this view (can not be null)members
- Contains a list of all the members in the view, can be empty but not null.
clone
public Object clone()
creates a copy of this view
- a copy of this view
containsMember
public boolean containsMember(Address mbr)
returns true, if this view contains a certain member
mbr
- - the address of the member,
- true if this view contains the member, false if it doesn't
if the argument mbr is null, this operation returns false
getCreator
public Address getCreator()
returns the creator of this view
if this view was created with the empty constructur, null will be returned
- the creator of this view in form of an Address object
getMembers
public Vector getMembers()
Returns a reference to the List of members (ordered)
Do NOT change this list, hence your will invalidate the view
Make a copy if you have to modify it.
- a reference to the ordered list of members in this view
getVid
public ViewId getVid()
returns the view ID of this view
if this view was created with the empty constructur, null will be returned
- the view ID of this view
printDetails
public String printDetails()
debug only
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
size
public int size()
returns the number of members in this view
- the number of members in this view 0..n
toString
public String toString()
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.