org.jgroups.util
Class MutableDigest

java.lang.Object
  extended by org.jgroups.util.Digest
      extended by org.jgroups.util.MutableDigest
All Implemented Interfaces:
java.lang.Iterable<Digest.DigestEntry>, Streamable

public class MutableDigest
extends Digest

A mutable version of Digest. This class is not synchronized because only a single thread at a time will access it

Author:
Bela Ban

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jgroups.util.Digest
Digest.DigestEntry, Digest.MyIterator
 
Field Summary
protected  int current_index
           
protected static double RESIZE_FACTOR
           
protected  boolean sealed
           
 
Fields inherited from class org.jgroups.util.Digest
members, seqnos
 
Constructor Summary
  MutableDigest()
          Used for externalization
protected MutableDigest(Address[] members, long[] seqnos, int current_index)
           
  MutableDigest(Digest digest)
           
  MutableDigest(int size)
           
  MutableDigest(java.util.Map<Address,long[]> map)
           
 
Method Summary
 void add(Address member, long highest_delivered_seqno, long highest_received_seqno)
           
 void add(Address member, long highest_delivered_seqno, long highest_received_seqno, boolean replace)
           
 void add(Digest digest)
           
 void add(Digest digest, boolean replace)
           
protected  void checkSealed()
           
 void clear()
           
 MutableDigest copy()
           
 void incrementHighestDeliveredSeqno(Address member)
          Increments the sender's highest delivered seqno by 1
 void merge(Address member, 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.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 member 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)
           
protected  void resize()
           
 void seal()
          Seals the instance against modifications
 void setHighestDeliveredAndSeenSeqnos(Address member, long highest_delivered_seqno, long highest_received_seqno)
           
 int size()
           
 
Methods inherited from class org.jgroups.util.Digest
contains, containsAll, createArrays, createArrays, difference, equals, find, get, getMembers, highestDeliveredSeqnoAt, highestReceivedSeqnoAt, highestSequence, isGreaterThanOrEqual, iterator, printHighestDeliveredSeqnos, readFrom, sameSenders, serializedSize, toString, toStringSorted, toStringSorted, writeTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESIZE_FACTOR

protected static final double RESIZE_FACTOR
See Also:
Constant Field Values

sealed

protected boolean sealed

current_index

protected int current_index
Constructor Detail

MutableDigest

protected MutableDigest(Address[] members,
                        long[] seqnos,
                        int current_index)

MutableDigest

public MutableDigest()
Used for externalization


MutableDigest

public MutableDigest(int size)

MutableDigest

public MutableDigest(java.util.Map<Address,long[]> map)

MutableDigest

public MutableDigest(Digest digest)
Method Detail

add

public void add(Address member,
                long highest_delivered_seqno,
                long highest_received_seqno)

add

public void add(Address member,
                long highest_delivered_seqno,
                long highest_received_seqno,
                boolean replace)

add

public void add(Digest digest)

add

public void add(Digest digest,
                boolean replace)

replace

public void replace(Digest d)

copy

public MutableDigest copy()
Overrides:
copy in class Digest

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 member,
                  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.highest_delivered_seqno=max(this.highest_delivered_seqno, highest_delivered_seqno)
  2. this.highest_received_seqno=max(this.highest_received_seqno, highest_received_seqno)
If the member doesn not exist, a new entry will be added (provided there is enough space)


incrementHighestDeliveredSeqno

public void incrementHighestDeliveredSeqno(Address member)
Increments the sender's highest delivered seqno by 1


clear

public void clear()

setHighestDeliveredAndSeenSeqnos

public void setHighestDeliveredAndSeenSeqnos(Address member,
                                             long highest_delivered_seqno,
                                             long highest_received_seqno)

seal

public void seal()
Seals the instance against modifications


size

public int size()
Overrides:
size in class Digest

resize

protected void resize()

checkSealed

protected final void checkSealed()


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