org.jgroups
Class ViewId

java.lang.Object
  extended byorg.jgroups.ViewId
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Externalizable, java.io.Serializable

public class ViewId
extends java.lang.Object
implements java.io.Externalizable, java.lang.Comparable, java.lang.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.

See Also:
Serialized Form

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
 java.lang.Object clone()
          Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view
 int compare(java.lang.Object o)
          Old Compare
 int compareTo(java.lang.Object other)
          Establishes an order between 2 ViewIds.
 ViewId copy()
          Old Copy method, deprecated because it is substituted by clone()
 boolean equals(java.lang.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(java.io.ObjectInput in)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ViewId

public ViewId()

ViewId

public ViewId(Address coord_addr)
Creates a ViewID with the coordinator address and a Lamport timestamp of 0.


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

getId

public long getId()
returns the lamport time of the view

Returns:
the lamport time timestamp

getCoordAddress

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

Returns:
the Address of the the issuer

toString

public java.lang.String toString()

clone

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


copy

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


compareTo

public int compareTo(java.lang.Object other)
Establishes an order between 2 ViewIds. First compare on id. Compare on coord_addr only if necessary (i.e. ids are equal) !

Specified by:
compareTo in interface java.lang.Comparable
Returns:
0 for equality, value less than 0 if smaller, greater than 0 if greater.

compare

public int compare(java.lang.Object o)
Old Compare


equals

public boolean equals(java.lang.Object other_view)

hashCode

public int hashCode()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 2001,2002 www.jgroups.com . All Rights Reserved.