public class SequenceNumberTracker extends Object
verify(long)
method are checked for completeness. I.e.
every sequence number has been passed in exactly once.
While checking for completeness, the tracker allows for sequence numbers to be passed in out of order. Therefore it
keeps track of a short history. The patience
parameter specifies the length of this history controlling how
much the expected sequence number can advance before the missing sequence number is reported as missing. If the
missing sequence number is passed in before the the expected sequence number advances to much, the element is
considered out-of-order but not missing and history is updated.
To allow re-initialisation of sequence numbers, the tracker is lenient for huge sequence number jumps. If the passed
in sequence number differs from the expected sequence number by more than what patience
parameters allows,
the tracker is reset and the element is considered valid.Constructor and Description |
---|
SequenceNumberTracker(int patience) |
Modifier and Type | Method and Description |
---|---|
int |
getPatience()
Number of elements that could be out of order.
|
boolean |
verify(long sequenceNumber) |
Copyright © 2021. All rights reserved.