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.Object
clone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this viewint
compare(java.lang.Object o)
Old Compareint
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 viewlong
getId()
returns the lamport time of the viewint
hashCode()
void
readExternal(java.io.ObjectInput in)
void
readFrom(java.io.DataInputStream in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedint
serializedSize()
java.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
void
writeTo(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:
toString
in 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:
clone
in 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:
compareTo
in 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.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 interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeTo
public void writeTo(java.io.DataOutputStream out) throws java.io.IOException
Description copied from interface:Streamable
Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed- Specified by:
writeTo
in interfaceStreamable
- Throws:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInputStream in) throws java.io.IOException, java.lang.IllegalAccessException, java.lang.InstantiationException
Description copied from interface:Streamable
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed- Specified by:
readFrom
in interfaceStreamable
- Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.InstantiationException
-
serializedSize
public int serializedSize()
-
-