Class SequenceNumberManager


  • public class SequenceNumberManager
    extends java.lang.Object
    Manages the messages sequence number (keeps it up-to-date)
    Since:
    3.1
    Author:
    Pedro Ruivo
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long get()  
      long getAndIncrement()  
      void update​(long otherSequenceNumber)
      updates the sequence number to the maximum between them
      long updateAndGet​(long otherSequenceNumber)
      updates the sequence number and returns the next, that will be used a propose sequence number
      • Methods inherited from class java.lang.Object

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

      • SequenceNumberManager

        public SequenceNumberManager()
    • Method Detail

      • getAndIncrement

        public long getAndIncrement()
        Returns:
        the next sequence number
      • update

        public void update​(long otherSequenceNumber)
        updates the sequence number to the maximum between them
        Parameters:
        otherSequenceNumber - the sequence number received
      • updateAndGet

        public long updateAndGet​(long otherSequenceNumber)
        updates the sequence number and returns the next, that will be used a propose sequence number
        Parameters:
        otherSequenceNumber - the sequence number received
        Returns:
        the next sequence number or the received sequence number, if the received sequence number is higher the the actual sequence number
      • get

        public long get()