org.jgroups.util

## Class MutableDigest

- java.lang.Object
- - org.jgroups.util.Digest
  - - org.jgroups.util.MutableDigest

- All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, Streamable

      public class MutableDigest
      extends Digest

  A mutable version of Digest (which is immutable
  Author:
    Bela Ban
  See Also:
    Serialized Form

- - ### 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

    Constructors
    Constructor and Description
    `MutableDigest()` Used for externalization
    `MutableDigest(Digest digest)`
    `MutableDigest(int size)`
    `MutableDigest(java.util.Map<Address,Digest.Entry> map)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Address sender, long low_seqno, long highest_delivered_seqno)`
    `void` | `add(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno)`
    `void` | `add(Digest digest)`
    `void` | `clear()`
    `java.util.Map<Address,Digest.Entry>` | `getSenders()` Returns an unmodifiable map, so modifications will result in exceptions
    `void` | `incrementHighestDeliveredSeqno(Address sender)` Increments the sender's highest delivered seqno by 1
    `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) If the sender doesn not exist, a new entry will be added (provided there is enough space)
    `void` | `merge(Digest digest)` Adds a digest to this digest.
    `void` | `replace(Digest d)`
    `void` | `resetAt(Address sender)` Resets the seqnos for the sender at 'index' to 0.
    `boolean` | `seal()` Seals the instance against modifications
    `boolean` | `set(Address sender, long low_seqno, long highest_delivered_seqno, long highest_received_seqno)`
    `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, toStringSorted, writeExternal, writeTo`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MutableDigest

          public MutableDigest()

      Used for externalization

    - #### MutableDigest

          public MutableDigest(int size)

    - #### MutableDigest

          public MutableDigest(java.util.Map<Address,Digest.Entry> map)

    - #### MutableDigest

          public MutableDigest(Digest digest)

  - ### Method Detail

    - #### getSenders

          public java.util.Map<Address,Digest.Entry> getSenders()

      Description copied from class: `Digest`
      Returns an unmodifiable map, so modifications will result in exceptions
      Overrides:
        `getSenders` in class `Digest`

    - #### add

          public void add(Address sender,
                 long low_seqno,
                 long highest_delivered_seqno)

    - #### add

          public void add(Address sender,
                 long low_seqno,
                 long highest_delivered_seqno,
                 long highest_received_seqno)

    - #### add

          public void add(Digest digest)

    - #### replace

          public void replace(Digest d)

    - #### set

          public boolean set(Address sender,
                    long low_seqno,
                    long highest_delivered_seqno,
                    long highest_received_seqno)

    - #### merge

          public void merge(Digest digest)

      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:
      1. this.low_seqno=min(this.low_seqno, low_seqno)
      2. this.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno)
      3. 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)

    - #### incrementHighestDeliveredSeqno

          public void incrementHighestDeliveredSeqno(Address sender)

      Increments the sender's highest delivered seqno by 1

    - #### resetAt

          public void resetAt(Address sender)

      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

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.