Package org.jgroups
Class ViewId
- java.lang.Object
-
- org.jgroups.ViewId
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable,Streamable
public class ViewId extends java.lang.Object implements java.io.Externalizable, java.lang.Comparable, java.lang.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.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this viewintcompare(java.lang.Object o)Old CompareintcompareTo(java.lang.Object other)Establishes an order between 2 ViewIds.ViewIdcopy()Old Copy method, deprecated because it is substituted by clone()booleanequals(java.lang.Object other_view)AddressgetCoordAddress()returns the address of the member that issued this viewlonggetId()returns the lamport time of the viewinthashCode()voidreadExternal(java.io.ObjectInput in)voidreadFrom(java.io.DataInputStream in)Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedintserializedSize()java.lang.StringtoString()voidwriteExternal(java.io.ObjectOutput out)voidwriteTo(java.io.DataOutputStream out)Write the entire state of the current object (including superclasses) to outstream.
-
-
-
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 viewid- - 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()
- Overrides:
toStringin classjava.lang.Object
-
clone
public java.lang.Object clone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view- Overrides:
clonein classjava.lang.Object
-
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:
compareToin interfacejava.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)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeTo
public void writeTo(java.io.DataOutputStream out) throws java.io.IOExceptionDescription copied from interface:StreamableWrite the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed- Specified by:
writeToin interfaceStreamable- Throws:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInputStream in) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.InstantiationExceptionDescription copied from interface:StreamableRead the state of the current object (including superclasses) from instream Note that the input stream must not be closed- Specified by:
readFromin interfaceStreamable- Throws:
java.io.IOExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationException
-
serializedSize
public int serializedSize()
-
-