Package org.jgroups.util
Class MutableDigest
- java.lang.Object
-
- org.jgroups.util.Digest
-
- org.jgroups.util.MutableDigest
-
- All Implemented Interfaces:
java.lang.Iterable<Digest.Entry>
,Constructable<Digest>
,SizeStreamable
,Streamable
public class MutableDigest extends Digest
A mutable version of Digest. Has a fixed size (that of the members), but individual seqnos can be changed. This class is not synchronized- Author:
- Bela Ban
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgroups.util.Digest
Digest.Entry, Digest.MyIterator
-
-
Constructor Summary
Constructors Constructor Description MutableDigest()
MutableDigest(Address[] members)
MutableDigest(Digest digest)
Only used for testing
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allSet()
Returns true if all members have a corresponding seqno >= 0, else falseprotected int
countNonSetMembers()
java.util.function.Supplier<? extends Digest>
create()
Creates an instance of the class implementing this interfaceprotected static long[]
createEmptyArray(int size)
Address[]
getNonSetMembers()
Returns an array of members whose seqno is not set.MutableDigest
merge(Address member, long highest_delivered_seqno, long highest_received_seqno)
Similar to set(), but if the sender already exists, its seqnos will be modified (no new entry) as follows: this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno) this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno)MutableDigest
merge(Digest digest)
Adds a digest to this digest.MutableDigest
set(Address member, long highest_delivered_seqno, long highest_received_seqno)
MutableDigest
set(Digest digest)
-
Methods inherited from class org.jgroups.util.Digest
capacity, checkPostcondition, contains, containsAll, copy, createArrays, equals, find, get, getMembersRaw, iterator, readFrom, readFrom, serializedSize, serializedSize, toString, toString, toString, writeTo, writeTo
-
-
-
-
Method Detail
-
set
public MutableDigest set(Address member, long highest_delivered_seqno, long highest_received_seqno)
-
create
public java.util.function.Supplier<? extends Digest> create()
Description copied from interface:Constructable
Creates an instance of the class implementing this interface- Specified by:
create
in interfaceConstructable<Digest>
- Overrides:
create
in classDigest
-
allSet
public boolean allSet()
Returns true if all members have a corresponding seqno >= 0, else false
-
getNonSetMembers
public Address[] getNonSetMembers()
Returns an array of members whose seqno is not set. Returns an empty array if all are set.
-
set
public MutableDigest set(Digest digest)
-
merge
public MutableDigest merge(Digest digest)
Adds a digest to this digest. For each sender in the other digest, the merge() method will be called.
-
merge
public MutableDigest merge(Address member, long highest_delivered_seqno, long highest_received_seqno)
Similar to set(), but if the sender already exists, its seqnos will be modified (no new entry) as follows:- this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno)
- this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno)
-
createEmptyArray
protected static long[] createEmptyArray(int size)
-
countNonSetMembers
protected int countNonSetMembers()
-
-