Package org.jgroups
Class MergeView
- java.lang.Object
-
- org.jgroups.View
-
- org.jgroups.MergeView
-
- All Implemented Interfaces:
java.lang.Comparable<View>
,java.lang.Iterable<Address>
,Constructable<View>
,SizeStreamable
,Streamable
public class MergeView extends View
A view that is sent as a result of a cluster merge. Whenever a group splits into subgroups, e.g., due to a network partition, and later the subgroups merge back together, a MergeView instead of a View will be received by the application. The MergeView class is a subclass of View and contains as additional instance variable: the list of views that were merged. For example, if the group denoted by view V1:(p,q,r,s,t) splits into subgroups V2:(p,q,r) and V2:(s,t), the merged view might be V3:(p,q,r,s,t). In this case the MergeView would contain a list of 2 views: V2:(p,q,r) and V2:(s,t).- Since:
- 2.0
- Author:
- Bela Ban
-
-
Constructor Summary
Constructors Constructor Description MergeView()
MergeView(Address creator, long id, java.util.List<Address> members, java.util.List<View> subgroups)
Creates a new viewMergeView(ViewId view_id, java.util.List<Address> members, java.util.List<View> subgroups)
Creates a new merge viewMergeView(ViewId view_id, Address[] members, java.util.List<View> subgroups)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MergeView
copy()
java.util.function.Supplier<? extends MergeView>
create()
Creates an instance of the class implementing this interfaceboolean
deepEquals(View other)
protected Address
get(int index)
protected int
get(Address member)
java.util.List<View>
getSubgroups()
protected static View[]
listToArray(java.util.List<View> list)
void
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream Note that the input stream must not be closedint
serializedSize()
Returns the size (in bytes) of the marshalled objectjava.lang.String
toString()
void
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.-
Methods inherited from class org.jgroups.View
compareTo, containsMember, containsMembers, create, create, diff, equals, getCoord, getCreator, getMembers, getMembersRaw, getViewId, hashCode, iterator, leftMembers, newMembers, printDiff, sameMembers, sameMembersOrdered, sameViews, sameViews, size
-
-
-
-
Field Detail
-
subgroups
protected View[] subgroups
-
-
Constructor Detail
-
MergeView
public MergeView()
-
MergeView
public MergeView(ViewId view_id, java.util.List<Address> members, java.util.List<View> subgroups)
Creates a new merge view- Parameters:
view_id
- The view id of this view (can not be null)members
- Contains a list of all the members in the view, can be empty but not null.subgroups
- A list of Views representing the former subgroups
-
MergeView
public MergeView(Address creator, long id, java.util.List<Address> members, java.util.List<View> subgroups)
Creates a new view- Parameters:
creator
- The creator of this view (can not be null)id
- The lamport timestamp of this viewmembers
- Contains a list of all the members in the view, can be empty but not null.subgroups
- A list of Views representing the former subgroups
-
-
Method Detail
-
create
public java.util.function.Supplier<? extends MergeView> create()
Description copied from interface:Constructable
Creates an instance of the class implementing this interface- Specified by:
create
in interfaceConstructable<View>
- Overrides:
create
in classView
-
getSubgroups
public java.util.List<View> getSubgroups()
-
copy
public MergeView copy()
-
deepEquals
public boolean deepEquals(View other)
- Overrides:
deepEquals
in classView
-
writeTo
public void writeTo(java.io.DataOutput 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
- Overrides:
writeTo
in classView
- Throws:
java.io.IOException
-
readFrom
public void readFrom(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundException
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
- Overrides:
readFrom
in classView
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
serializedSize
public int serializedSize()
Description copied from interface:SizeStreamable
Returns the size (in bytes) of the marshalled object- Specified by:
serializedSize
in interfaceSizeStreamable
- Overrides:
serializedSize
in classView
-
get
protected int get(Address member)
-
get
protected Address get(int index)
-
-