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 ofRateLimiter
that 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.void
notifyCheckpointComplete(long checkpointId)
Notifies thisRateLimiter
that the checkpoint with the givencheckpointId
completed and was committed.
-
-
-
Method Detail
-
acquire
public CompletionStage<Void> acquire()
Description copied from interface:RateLimiter
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.- Specified by:
acquire
in interfaceRateLimiter
-
notifyCheckpointComplete
public void notifyCheckpointComplete(long checkpointId)
Description copied from interface:RateLimiter
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.- Specified by:
notifyCheckpointComplete
in interfaceRateLimiter
- Parameters:
checkpointId
- The ID of the checkpoint that has been completed.
-
-