org.jgroups

Class ViewId

Implemented Interfaces:
Cloneable, Comparable, Externalizable

public class ViewId
extends java.lang.Object
implements Externalizable, Comparable, Cloneable

ViewIds are used for ordering views (each view has a ViewId and a list of members). Ordering between views is important for example in a virtual synchrony protocol where all views seen by a member have to be ordered.

Constructor Summary

ViewId()
ViewId(Address coord_addr)
Creates a ViewID with the coordinator address and a Lamport timestamp of 0.
ViewId(Address coord_addr, long id)
Creates a ViewID with the coordinator address and the given Lamport timestamp.

Method Summary

Object
clone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view
int
compare(Object o)
Old Compare
int
compareTo(Object other)
Establishes an order between 2 ViewIds.
ViewId
copy()
Old Copy method, deprecated because it is substituted by clone()
boolean
equals(Object other_view)
Address
getCoordAddress()
returns the address of the member that issued this view
long
getId()
returns the lamport time of the view
int
hashCode()
void
readExternal(ObjectInput in)
String
toString()
void
writeExternal(ObjectOutput out)

Constructor Details

ViewId

public ViewId()

ViewId

public ViewId(Address coord_addr)
Creates a ViewID with the coordinator address and a Lamport timestamp of 0.
Parameters:
coord_addr - the address of the member that issued this view

ViewId

public ViewId(Address coord_addr,
              long id)
Creates a ViewID with the coordinator address and the given Lamport timestamp.
Parameters:
coord_addr - - the address of the member that issued this view
id - - the Lamport timestamp of the view

Method Details

clone

public Object clone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view

compare

public int compare(Object o)
Old Compare

compareTo

public int compareTo(Object other)
Establishes an order between 2 ViewIds. First compare on id. Compare on coord_addr only if necessary (i.e. ids are equal) !
Returns:
0 for equality, value less than 0 if smaller, greater than 0 if greater.

copy

public ViewId copy()
Old Copy method, deprecated because it is substituted by clone()

equals

public boolean equals(Object other_view)

getCoordAddress

public Address getCoordAddress()
returns the address of the member that issued this view
Returns:
the Address of the the issuer

getId

public long getId()
returns the lamport time of the view
Returns:
the lamport time timestamp

hashCode

public int hashCode()

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException

Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.