Record Class BackpressureController.BackpressureStats

java.lang.Object
java.lang.Record
com.loomcache.server.network.BackpressureController.BackpressureStats
Record Components:
peerId - peer identifier (non-null)
currentQueueDepth - number of unacknowledged messages (non-negative)
pendingBytes - total size of pending data in bytes (non-negative)
totalThrottled - cumulative messages dropped due to backpressure (non-negative)
peakQueueDepth - highest queue depth observed for this peer (non-negative)
inBackpressure - true if peer is currently backpressured
highWatermark - current high watermark setting (positive)
lowWatermark - current low watermark setting (positive, less than high)
Enclosing class:
BackpressureController

public static record BackpressureController.BackpressureStats(String peerId, int currentQueueDepth, long pendingBytes, long totalThrottled, long peakQueueDepth, boolean inBackpressure, int highWatermark, int lowWatermark) extends Record
Immutable snapshot of backpressure statistics for a single peer.
Since:
1.0
  • Constructor Details

    • BackpressureStats

      public BackpressureStats(String peerId, int currentQueueDepth, long pendingBytes, long totalThrottled, long peakQueueDepth, boolean inBackpressure, int highWatermark, int lowWatermark)
      Create a BackpressureStats with validation.
      Throws:
      NullPointerException - if peerId is null
      IllegalArgumentException - if numeric values are invalid
  • Method Details

    • utilizationPercent

      public double utilizationPercent()
      Calculate the percentage of the high watermark currently in use.
      Returns:
      percentage (0-100+), or 0 if highWatermark is 0
    • summary

      public String summary()
      Get a human-readable summary of backpressure state.
      Returns:
      summary string describing current backpressure status
    • toString

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • peerId

      public String peerId()
      Returns the value of the peerId record component.
      Returns:
      the value of the peerId record component
    • currentQueueDepth

      public int currentQueueDepth()
      Returns the value of the currentQueueDepth record component.
      Returns:
      the value of the currentQueueDepth record component
    • pendingBytes

      public long pendingBytes()
      Returns the value of the pendingBytes record component.
      Returns:
      the value of the pendingBytes record component
    • totalThrottled

      public long totalThrottled()
      Returns the value of the totalThrottled record component.
      Returns:
      the value of the totalThrottled record component
    • peakQueueDepth

      public long peakQueueDepth()
      Returns the value of the peakQueueDepth record component.
      Returns:
      the value of the peakQueueDepth record component
    • inBackpressure

      public boolean inBackpressure()
      Returns the value of the inBackpressure record component.
      Returns:
      the value of the inBackpressure record component
    • highWatermark

      public int highWatermark()
      Returns the value of the highWatermark record component.
      Returns:
      the value of the highWatermark record component
    • lowWatermark

      public int lowWatermark()
      Returns the value of the lowWatermark record component.
      Returns:
      the value of the lowWatermark record component