Class GatedRateLimiter<Split extends SourceSplit>
- java.lang.Object
-
- org.apache.flink.api.connector.source.util.ratelimit.GatedRateLimiter<Split>
-
- All Implemented Interfaces:
RateLimiter<Split>
@Internal public class GatedRateLimiter<Split extends SourceSplit> extends Object implements RateLimiter<Split>
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(int numberOfEvents)Returns a future that is completed once other events would not exceed the rate limit.voidnotifyCheckpointComplete(long checkpointId)Notifies thisRateLimiterthat the checkpoint with the givencheckpointIdcompleted and was committed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.api.connector.source.util.ratelimit.RateLimiter
acquire, notifyAddingSplit
-
-
-
-
Method Detail
-
acquire
public CompletionStage<Void> acquire(int numberOfEvents)
Description copied from interface:RateLimiterReturns 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.- Specified by:
acquirein interfaceRateLimiter<Split extends SourceSplit>- Parameters:
numberOfEvents- The number of events.
-
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<Split extends SourceSplit>- Parameters:
checkpointId- The ID of the checkpoint that has been completed.
-
-