Class SequenceNumberTracker


  • public class SequenceNumberTracker
    extends java.lang.Object
    Tracks sequence numbers and verify completeness. Sequence numbers passed in to the tracker using the 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getPatience()
      Number of elements that could be out of order.
      boolean verify​(long sequenceNumber)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SequenceNumberTracker

        public SequenceNumberTracker​(int patience)
    • Method Detail

      • verify

        public boolean verify​(long sequenceNumber)
      • getPatience

        public int getPatience()
        Number of elements that could be out of order.