Package org.jgroups
Class ViewId
java.lang.Object
org.jgroups.ViewId
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Comparable
,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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this viewint
Old Compareint
Establishes an order between 2 ViewIds.copy()
Old Copy method, deprecated because it is substituted by clone()boolean
returns the address of the member that issued this viewlong
getId()
returns the lamport time of the viewint
hashCode()
void
void
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedint
toString()
void
void
writeTo
(DataOutputStream out) Write the entire state of the current object (including superclasses) to outstream.
-
Constructor Details
-
ViewId
public ViewId() -
ViewId
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
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 Details
-
getId
public long getId()returns the lamport time of the view- Returns:
- the lamport time timestamp
-
getCoordAddress
returns the address of the member that issued this view- Returns:
- the Address of the the issuer
-
toString
-
clone
Cloneable interface Returns a new ViewID object containing the same address and lamport timestamp as this view -
copy
Old Copy method, deprecated because it is substituted by clone() -
compareTo
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 interfaceComparable
- Returns:
- 0 for equality, value less than 0 if smaller, greater than 0 if greater.
-
compare
Old Compare -
equals
-
hashCode
public int hashCode() -
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeTo
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:
IOException
-
readFrom
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, 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:
IOException
IllegalAccessException
InstantiationException
-
serializedSize
public int serializedSize()
-