org.jgroups
Class View
- Cloneable, Externalizable, Streamable
public class View
extends java.lang.Object
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
|
boolean | equals(Object obj)
|
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)
|
void | readFrom(DataInputStream in) - Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
int | serializedSize()
|
int | size() - returns the number of members in this view
|
String | toString()
|
void | writeExternal(ObjectOutput out)
|
void | writeTo(DataOutputStream out) - Write the entire state of the current object (including superclasses) to outstream.
|
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
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
equals
public boolean equals(Object obj)
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
printDetails
public String printDetails()
debug only
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readFrom
public void readFrom(DataInputStream in)
throws IOException,
IllegalAccessException,
InstantiationException
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
- readFrom in interface Streamable
serializedSize
public int serializedSize()
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
writeTo
public void writeTo(DataOutputStream out)
throws IOException
Write the entire state of the current object (including superclasses) to outstream.
Note that the output stream must not be closed
- writeTo in interface Streamable
Copyright B) 1998-2005 Bela Ban. All Rights Reserved.