Interface RateLimiter<SplitT extends SourceSplit>
-
- Type Parameters:
SplitT- The type of the source splits.
- All Known Implementing Classes:
GatedRateLimiter,GuavaRateLimiter,NoOpRateLimiter
@NotThreadSafe @Experimental public interface RateLimiter<SplitT extends SourceSplit>The interface to rate limit execution of methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CompletionStage<Void>acquire()Returns a future that is completed once another event would not exceed the rate limit.CompletionStage<Void>acquire(int numberOfEvents)Returns a future that is completed once other events would not exceed the rate limit.default voidnotifyAddingSplit(SplitT split)Notifies thisRateLimiterthat a new split has been added.default voidnotifyCheckpointComplete(long checkpointId)Notifies thisRateLimiterthat the checkpoint with the givencheckpointIdcompleted and was committed.
-
-
-
Method Detail
-
acquire
default 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.
-
acquire
CompletionStage<Void> acquire(int numberOfEvents)
Returns a future that is completed once other events 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.- Parameters:
numberOfEvents- The number of events.
-
notifyCheckpointComplete
default void notifyCheckpointComplete(long checkpointId)
Notifies thisRateLimiterthat the checkpoint with the givencheckpointIdcompleted 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.
-
notifyAddingSplit
default void notifyAddingSplit(SplitT split)
Notifies thisRateLimiterthat a new split has been added. For correct functioning, this method should only be invoked after the returned future of previousacquire(int)method invocation has been completed.- Parameters:
split- The split that has been added.
-
-