Interface RequestLimiter<C>
- All Known Implementing Classes:
CommandRateLimiter,NoopRequestLimiter
public interface RequestLimiter<C>
-
Method Summary
Modifier and TypeMethodDescriptionintintgetLimit()voidonIgnore(int streamId, long requestId) Notify when a request is cancelled aftertryAcquire(int, long, Object)was success.voidonResponse(int streamId, long requestId) Notify when a request processing is completed by calling this method.booleantryAcquire(int streamId, long requestId, C context) Try to add to the inflight requests.
-
Method Details
-
tryAcquire
Try to add to the inflight requests. If success,onResponse(int, long)()} must be called when the request * is processed.- Parameters:
streamId-requestId-context- some limiters may use additional context to decide if a request should be accepted- Returns:
- true if request is added to the inflight requests, false otherwise
-
onResponse
void onResponse(int streamId, long requestId) Notify when a request processing is completed by calling this method.- Parameters:
streamId-requestId-
-
onIgnore
void onIgnore(int streamId, long requestId) Notify when a request is cancelled aftertryAcquire(int, long, Object)was success.- Parameters:
streamId-requestId-
-
getLimit
int getLimit() -
getInflightCount
int getInflightCount()
-