Class GatedRateLimiter
- java.lang.Object
-
- org.apache.flink.api.connector.source.util.ratelimit.GatedRateLimiter
-
- All Implemented Interfaces:
RateLimiter
@Internal public class GatedRateLimiter extends Object implements RateLimiter
An implementation ofRateLimiterthat completes defined number of futures in-between the external notification events. The first cycle completes immediately, without waiting for the external notifications.
-
-
Constructor Summary
Constructors Constructor Description GatedRateLimiter(int capacityPerCycle)Instantiates a new GatedRateLimiter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<Void>acquire()Returns a future that is completed once another event would not exceed the rate limit.voidnotifyCheckpointComplete(long checkpointId)Notifies thisRateLimiterthat the checkpoint with the givencheckpointIdcompleted and was committed.
-
-
-
Method Detail
-
acquire
public CompletionStage<Void> acquire()
Description copied from interface:RateLimiterReturns 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.- Specified by:
acquirein interfaceRateLimiter
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId)
Description copied from interface:RateLimiterNotifies thisRateLimiterthat the checkpoint with the givencheckpointIdcompleted and was committed. Makes it possible to implement rate limiters that control data emission per checkpoint cycle.- Specified by:
notifyCheckpointCompletein interfaceRateLimiter- Parameters:
checkpointId- The ID of the checkpoint that has been completed.
-
-