|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.stack.AckReceiverWindow
public class AckReceiverWindow
Counterpart of AckSenderWindow. Simple FIFO buffer.
Every message received is ACK'ed (even duplicates) and added to a hashmap
keyed by seqno. The next seqno to be received is stored in next_to_remove
. When a message with
a seqno less than next_to_remove is received, it will be discarded. The remove()
method removes
and returns a message whose seqno is equal to next_to_remove, or null if not found.
Change May 28 2002 (bela): replaced TreeSet with HashMap. Keys do not need to be sorted, and adding a key to
a sorted set incurs overhead.
Field Summary | |
---|---|
static Message |
TOMBSTONE
|
Constructor Summary | |
---|---|
AckReceiverWindow(long initial_seqno)
|
|
AckReceiverWindow(long initial_seqno,
int segment_capacity)
|
Method Summary | |
---|---|
boolean |
add(long seqno,
Message msg)
Adds a new message. |
byte |
add2(long seqno,
Message msg)
Adds a message if not yet received |
java.util.concurrent.atomic.AtomicBoolean |
getProcessing()
|
java.lang.String |
printMessages()
|
Message |
remove()
Removes a message whose seqno is equal to next_to_remove , increments the latter. |
Tuple<java.util.List<Message>,java.lang.Long> |
removeMany(int max)
Removes as many messages as possible (in sequence, without gaps) |
java.util.List<Message> |
removeManyAsList(int max)
|
void |
reset()
|
int |
size()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Message TOMBSTONE
Constructor Detail |
---|
public AckReceiverWindow(long initial_seqno)
public AckReceiverWindow(long initial_seqno, int segment_capacity)
Method Detail |
---|
public java.util.concurrent.atomic.AtomicBoolean getProcessing()
public boolean add(long seqno, Message msg)
public byte add2(long seqno, Message msg)
seqno
- msg
-
public Message remove()
next_to_remove
, increments the latter. Returns message
that was removed, or null, if no message can be removed. Messages are thus removed in order.
public Tuple<java.util.List<Message>,java.lang.Long> removeMany(int max)
max
- Max number of messages to be removed
public java.util.List<Message> removeManyAsList(int max)
public void reset()
public int size()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printMessages()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |