Record Class RateLimitDecision.Throttled
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.ratelimiting.RateLimitDecision.Throttled
- Record Components:
eventsInWindow- observed countlimit- configured limitwindow- configured windowretryAfter- duration until the oldest in-window event falls out of the window — a fair lower bound forRetry-After; non-null, non-negative
- All Implemented Interfaces:
RateLimitDecision
- Enclosing interface:
RateLimitDecision
public static record RateLimitDecision.Throttled(int eventsInWindow, int limit, Duration window, Duration retryAfter)
extends Record
implements RateLimitDecision
The event was refused — the per-window count is already at or
above the configured limit.
-
Nested Class Summary
Nested classes/interfaces inherited from interface RateLimitDecision
RateLimitDecision.Allowed, RateLimitDecision.ThrottledModifier and TypeInterfaceDescriptionstatic final recordThe event was admitted; the caller proceeds.static final recordThe event was refused — the per-window count is already at or above the configured limit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theeventsInWindowrecord component.final inthashCode()Returns a hash code value for this object.intlimit()Returns the value of thelimitrecord component.Returns the value of theretryAfterrecord component.final StringtoString()Returns a string representation of this record class.window()Returns the value of thewindowrecord component.
-
Constructor Details
-
Throttled
-
-
Method Details
-
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. -
eventsInWindow
public int eventsInWindow()Returns the value of theeventsInWindowrecord component.- Specified by:
eventsInWindowin interfaceRateLimitDecision- Returns:
- the value of the
eventsInWindowrecord component
-
limit
public int limit()Returns the value of thelimitrecord component.- Specified by:
limitin interfaceRateLimitDecision- Returns:
- the value of the
limitrecord component
-
window
Returns the value of thewindowrecord component.- Specified by:
windowin interfaceRateLimitDecision- Returns:
- the value of the
windowrecord component
-
retryAfter
Returns the value of theretryAfterrecord component.- Returns:
- the value of the
retryAfterrecord component
-