Interface RateLimiter
-
- All Known Implementing Classes:
GatedRateLimiter
,GuavaRateLimiter
,NoOpRateLimiter
@NotThreadSafe @Experimental public interface RateLimiter
The interface to rate limit execution of methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletionStage<Void>
acquire()
Returns a future that is completed once another event would not exceed the rate limit.default void
notifyCheckpointComplete(long checkpointId)
Notifies thisRateLimiter
that the checkpoint with the givencheckpointId
completed and was committed.
-
-
-
Method Detail
-
acquire
CompletionStage<Void> acquire()
Returns a future that is completed once another event would not exceed the rate limit. For correct functioning, the next invocation of this method should only happen after the previously returned future has been completed.
-
notifyCheckpointComplete
default void notifyCheckpointComplete(long checkpointId)
Notifies thisRateLimiter
that the checkpoint with the givencheckpointId
completed and was committed. Makes it possible to implement rate limiters that control data emission per checkpoint cycle.- Parameters:
checkpointId
- The ID of the checkpoint that has been completed.
-
-