You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/29 11:59:40 UTC

[GitHub] [pulsar] aloyszhang commented on a change in pull request #7078: introduce precise topic publish rate limiting

aloyszhang commented on a change in pull request #7078:
URL: https://github.com/apache/pulsar/pull/7078#discussion_r432435725



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PublishRateLimiter.java
##########
@@ -66,6 +69,83 @@
      * @param clusterName
      */
     void update(PublishRate maxPublishRate);
+
+    /**
+     * try to acquire permit
+     * @param numbers
+     * @param bytes
+     * */
+    boolean tryAcquire(int numbers, long bytes);
+}
+
+class PrecisPublishLimiter implements PublishRateLimiter {
+    protected volatile int publishMaxMessageRate = 0;

Review comment:
       @merlimat  There will be barely concurrent update of these fields, so I think volatile here is ok.  Do you suggest to remove it ?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org