org.jgroups

Class ViewId

public class ViewId extends Object implements Externalizable, Comparable, Cloneable, Streamable

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
Objectclone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view
intcompare(Object o)
Old Compare
intcompareTo(Object other)
Establishes an order between 2 ViewIds.
ViewIdcopy()
Old Copy method, deprecated because it is substituted by clone()
booleanequals(Object other_view)
AddressgetCoordAddress()
returns the address of the member that issued this view
longgetId()
returns the lamport time of the view
inthashCode()
voidreadExternal(ObjectInput in)
voidreadFrom(DataInputStream in)
intserializedSize()
StringtoString()
voidwriteExternal(ObjectOutput out)
voidwriteTo(DataOutputStream out)

Constructor Detail

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 Detail

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)

readFrom

public void readFrom(DataInputStream in)

serializedSize

public int serializedSize()

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)

writeTo

public void writeTo(DataOutputStream out)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.