Package org.jgroups.util
Class MutableDigest
java.lang.Object
org.jgroups.util.Digest
org.jgroups.util.MutableDigest
- All Implemented Interfaces:
Externalizable
,Serializable
,Streamable
A mutable version of Digest (which is immutable
- Version:
- $Id: MutableDigest.java,v 1.6 2007/05/29 10:10:47 belaban Exp $
- Author:
- Bela Ban
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.util.Digest
Digest.Entry
-
Field Summary
Fields inherited from class org.jgroups.util.Digest
EMPTY_DIGEST, log, senders
-
Constructor Summary
ConstructorsConstructorDescriptionUsed for externalizationMutableDigest
(int size) MutableDigest
(Map<Address, Digest.Entry> map) MutableDigest
(Digest digest) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
void
clear()
Returns an unmodifiable map, so modifications will result in exceptionsvoid
Increments the sender's high_seqno by 1.void
Similar to add(), but if the sender already exists, its seqnos will be modified (no new entry) as follows: this.low_seqno=min(this.low_seqno, low_seqno) this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno) this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno) If the sender doesn not exist, a new entry will be added (provided there is enough space)void
Adds a digest to this digest.void
void
Resets the seqnos for the sender at 'index' to 0.boolean
seal()
Seals the instance against modificationsboolean
void
setHighestDeliveredAndSeenSeqnos
(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno) Methods inherited from class org.jgroups.util.Digest
contains, copy, difference, equals, get, highestDeliveredSeqnoAt, highestReceivedSeqnoAt, highestSequence, isGreaterThanOrEqual, lowSeqnoAt, printHighestDeliveredSeqnos, printHighestReceivedSeqnos, readExternal, readFrom, sameSenders, serializedSize, size, toString, writeExternal, writeTo
-
Constructor Details
-
MutableDigest
public MutableDigest()Used for externalization -
MutableDigest
public MutableDigest(int size) -
MutableDigest
-
MutableDigest
-
-
Method Details
-
getSenders
Description copied from class:Digest
Returns an unmodifiable map, so modifications will result in exceptions- Overrides:
getSenders
in classDigest
-
add
-
add
public void add(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno) -
add
-
replace
-
set
public boolean set(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno) -
merge
Adds a digest to this digest. This digest must have enough space to add the other digest; otherwise an error message will be written. For each sender in the other digest, the merge() method will be called. -
merge
public void merge(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno) Similar to add(), but if the sender already exists, its seqnos will be modified (no new entry) as follows:- this.low_seqno=min(this.low_seqno, low_seqno)
- this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno)
- this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno)
-
incrementHighestDeliveredSeqno
Increments the sender's high_seqno by 1. -
resetAt
Resets the seqnos for the sender at 'index' to 0. This happens when a member has left the group, but it is still in the digest. Resetting its seqnos ensures that no-one will request a message retransmission from the dead member. -
clear
public void clear() -
setHighestDeliveredAndSeenSeqnos
public void setHighestDeliveredAndSeenSeqnos(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno) -
seal
public boolean seal()Seals the instance against modifications
-