stevenzwu commented on code in PR #20757:
URL: https://github.com/apache/flink/pull/20757#discussion_r967254247


##########
flink-core/src/main/java/org/apache/flink/api/connector/source/lib/util/RateLimiter.java:
##########
@@ -22,8 +22,14 @@
 import java.util.concurrent.CompletionStage;
 
 /** The interface to rate limit execution of methods. */
-interface RateLimiter extends Serializable {
+public interface RateLimiter extends Serializable {
 
     /** Returns a future that is completed once another event would not exceed 
the rate limit. */
     CompletionStage<Void> acquire();
+
+    /**
+     * Can be used to modify rate-limiter's behaviour from the outside. Makes 
it possible to
+     * implement rate limiters based on external events rather than on time.
+     */
+    default void notifyRelease() {}

Review Comment:
   I also think it is a little weird to have `notifyRelease` in the base 
interface of `RateLimiter`.
   
   The alternative is to rename `GatedRateLimiter` to sth like 
`CyclicBarrierRateLimiter` and add a `reset` method there. The down side is 
that now we may need to do some type cast to check sub interface. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to