Package org.jgroups.util
Class MutableDigest
java.lang.Object
org.jgroups.util.Digest
org.jgroups.util.MutableDigest
- All Implemented Interfaces:
Iterable<Digest.Entry>,Constructable<Digest>,SizeStreamable,Streamable
A mutable version of Digest. Has a fixed size (that of the members), but individual seqnos can be changed.
This class is not synchronized
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.util.Digest
Digest.Entry, Digest.MyIterator -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionMutableDigest(Address[] members) MutableDigest(Digest digest) Only used for testing -
Method Summary
Modifier and TypeMethodDescriptionbooleanallSet()Returns true if all members have a corresponding seqno >= 0, else falseprotected intcreate()Creates an instance of the class implementing this interfaceprotected static long[]createEmptyArray(int size) Address[]Returns an array of members whose seqno is not set.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)Adds a digest to this 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, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MutableDigest
public MutableDigest() -
MutableDigest
-
MutableDigest
Only used for testing
-
-
Method Details
-
set
-
create
Description copied from interface:ConstructableCreates an instance of the class implementing this interface- Specified by:
createin interfaceConstructable<Digest>- Overrides:
createin classDigest
-
allSet
public boolean allSet()Returns true if all members have a corresponding seqno >= 0, else false -
getNonSetMembers
Returns an array of members whose seqno is not set. Returns an empty array if all are set. -
set
-
merge
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()
-