Package rife.engine

Record Class SseHistoryStats

java.lang.Object
java.lang.Record
rife.engine.SseHistoryStats
Record Components:
capacity - the configured history capacity
buffered - the number of events that are currently buffered
oldestId - the sequence number of the oldest buffered event; or 0 when nothing is buffered. This is the bare number, while the ID that clients see also carries the broadcaster's epoch
newestId - the sequence number of the most recently sent event; or 0 when nothing has been sent yet, in the same bare form as oldestId
replays - the number of reconnections whose missed events were replayed from the history
gaps - the number of reconnections that couldn't be replayed since the events had already been evicted, or since the last received ID originated from a previous application instance
maxMissedEvents - the largest number of events that any reconnecting client had missed, only counting the reconnections whose ID this broadcaster instance could still relate to its own history

public record SseHistoryStats(int capacity, int buffered, long oldestId, long newestId, long replays, long gaps, long maxMissedEvents) extends Record
Provides a snapshot of the state of the event history of an SseBroadcaster, which is intended to help you tune the history capacity.

The most important numbers for tuning are gaps, which counts the reconnections that couldn't be fully served since the events had already been evicted from the history, and maxMissedEvents, which is the largest number of events that any reconnecting client had missed. A capacity of about twice the maximum miss will cover every reconnection that has been observed so far.

Note that the IDs in this snapshot are the bare sequence numbers that the broadcaster counts with, while the IDs that clients send back also carry the epoch of the broadcaster instance, so that they can't be compared to each other directly.

Since:
1.10
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    SseHistoryStats(int capacity, int buffered, long oldestId, long newestId, long replays, long gaps, long maxMissedEvents)
    Creates an instance of a SseHistoryStats record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the buffered record component.
    int
    Returns the value of the capacity record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the gaps record component.
    final int
    Returns a hash code value for this object.
    long
    Returns the value of the maxMissedEvents record component.
    long
    Returns the value of the newestId record component.
    long
    Returns the value of the oldestId record component.
    long
    Returns the value of the replays record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SseHistoryStats

      public SseHistoryStats(int capacity, int buffered, long oldestId, long newestId, long replays, long gaps, long maxMissedEvents)
      Creates an instance of a SseHistoryStats record class.
      Parameters:
      capacity - the value for the capacity record component
      buffered - the value for the buffered record component
      oldestId - the value for the oldestId record component
      newestId - the value for the newestId record component
      replays - the value for the replays record component
      gaps - the value for the gaps record component
      maxMissedEvents - the value for the maxMissedEvents record component
  • Method Details

    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • capacity

      public int capacity()
      Returns the value of the capacity record component.
      Returns:
      the value of the capacity record component
    • buffered

      public int buffered()
      Returns the value of the buffered record component.
      Returns:
      the value of the buffered record component
    • oldestId

      public long oldestId()
      Returns the value of the oldestId record component.
      Returns:
      the value of the oldestId record component
    • newestId

      public long newestId()
      Returns the value of the newestId record component.
      Returns:
      the value of the newestId record component
    • replays

      public long replays()
      Returns the value of the replays record component.
      Returns:
      the value of the replays record component
    • gaps

      public long gaps()
      Returns the value of the gaps record component.
      Returns:
      the value of the gaps record component
    • maxMissedEvents

      public long maxMissedEvents()
      Returns the value of the maxMissedEvents record component.
      Returns:
      the value of the maxMissedEvents record component