Package org.jgroups
Class ViewId
java.lang.Object
org.jgroups.ViewId
- All Implemented Interfaces:
Comparable<ViewId>,Constructable<ViewId>,SizeStreamable,Streamable
public class ViewId
extends Object
implements Comparable<ViewId>, SizeStreamable, Constructable<ViewId>
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintEstablishes an order between 2 ViewIds.intcompareToIDs(ViewId other) Establishes an order between 2 ViewIds.copy()create()Creates an instance of the class implementing this interfacebooleanReturns the address of the member that issued this viewlonggetId()returns the lamport time of the viewinthashCode()voidRead the state of the current object (including superclasses) from instream Note that the input stream must not be closedintReturns the size (in bytes) of the marshalled objecttoString()voidwriteTo(DataOutput out) Write the entire state of the current object (including superclasses) to outstream.
-
Field Details
-
creator
-
id
protected long id
-
-
Constructor Details
-
ViewId
public ViewId() -
ViewId
Creates a ViewID with the coordinator address and a Lamport timestamp of 0.- Parameters:
creator- the address of the member that issued this view
-
ViewId
Creates a ViewID with the coordinator address and the given Lamport timestamp.- Parameters:
creator- - the address of the member that issued this viewid- - the Lamport timestamp of the view
-
-
Method Details
-
create
Description copied from interface:ConstructableCreates an instance of the class implementing this interface- Specified by:
createin interfaceConstructable<ViewId>
-
getCreator
Returns the address of the member that issued this view- Returns:
- the Address of the the creator
-
getId
public long getId()returns the lamport time of the view- Returns:
- the lamport time timestamp
-
toString
-
copy
-
compareTo
Establishes an order between 2 ViewIds. The comparison is done on the IDs, if they are equal, we use the creator.- Specified by:
compareToin interfaceComparable<ViewId>- Returns:
- 0 for equality, value less than 0 if smaller, greater than 0 if greater.
-
compareToIDs
Establishes an order between 2 ViewIds. Note that we compare only on IDs !- Returns:
- 0 for equality, value less than 0 if smaller, greater than 0 if greater.
-
equals
-
hashCode
public int hashCode() -
writeTo
Description 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:
IOException
-
readFrom
Description 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:
IOExceptionClassNotFoundException
-
serializedSize
public int serializedSize()Description copied from interface:SizeStreamableReturns the size (in bytes) of the marshalled object- Specified by:
serializedSizein interfaceSizeStreamable
-