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 backpressuredhighWatermark- 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 Summary
ConstructorsConstructorDescriptionBackpressureStats(String peerId, int currentQueueDepth, long pendingBytes, long totalThrottled, long peakQueueDepth, boolean inBackpressure, int highWatermark, int lowWatermark) Create a BackpressureStats with validation. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thecurrentQueueDepthrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thehighWatermarkrecord component.booleanReturns the value of theinBackpressurerecord component.intReturns the value of thelowWatermarkrecord component.longReturns the value of thepeakQueueDepthrecord component.peerId()Returns the value of thepeerIdrecord component.longReturns the value of thependingBytesrecord component.summary()Get a human-readable summary of backpressure state.final StringtoString()Returns a string representation of this record class.longReturns the value of thetotalThrottledrecord component.doubleCalculate the percentage of the high watermark currently in use.
-
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 nullIllegalArgumentException- 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
Get a human-readable summary of backpressure state.- Returns:
- summary string describing current backpressure status
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
peerId
-
currentQueueDepth
public int currentQueueDepth()Returns the value of thecurrentQueueDepthrecord component.- Returns:
- the value of the
currentQueueDepthrecord component
-
pendingBytes
public long pendingBytes()Returns the value of thependingBytesrecord component.- Returns:
- the value of the
pendingBytesrecord component
-
totalThrottled
public long totalThrottled()Returns the value of thetotalThrottledrecord component.- Returns:
- the value of the
totalThrottledrecord component
-
peakQueueDepth
public long peakQueueDepth()Returns the value of thepeakQueueDepthrecord component.- Returns:
- the value of the
peakQueueDepthrecord component
-
inBackpressure
public boolean inBackpressure()Returns the value of theinBackpressurerecord component.- Returns:
- the value of the
inBackpressurerecord component
-
highWatermark
public int highWatermark()Returns the value of thehighWatermarkrecord component.- Returns:
- the value of the
highWatermarkrecord component
-
lowWatermark
public int lowWatermark()Returns the value of thelowWatermarkrecord component.- Returns:
- the value of the
lowWatermarkrecord component
-