@Internal public class GatedRateLimiter extends Object implements RateLimiter
RateLimiter
that completes defined number of futures in-between the
external notification events. The first cycle completes immediately, without waiting for the
external notifications.Constructor and Description |
---|
GatedRateLimiter(int capacityPerCycle)
Instantiates a new GatedRateLimiter.
|
Modifier and Type | Method and Description |
---|---|
CompletionStage<Void> |
acquire()
Returns a future that is completed once another event would not exceed the rate limit.
|
void |
notifyCheckpointComplete(long checkpointId)
Notifies this
RateLimiter that the checkpoint with the given checkpointId
completed and was committed. |
public GatedRateLimiter(int capacityPerCycle)
capacityPerCycle
- The number of completed futures per cycle.public CompletionStage<Void> acquire()
RateLimiter
acquire
in interface RateLimiter
public void notifyCheckpointComplete(long checkpointId)
RateLimiter
RateLimiter
that the checkpoint with the given checkpointId
completed and was committed. Makes it possible to implement rate limiters that control data
emission per checkpoint cycle.notifyCheckpointComplete
in interface RateLimiter
checkpointId
- The ID of the checkpoint that has been completed.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.