zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] hanm commented on a change in pull request #1051: ZOOKEEPER-3503: Add server side large request throttling
Date Wed, 14 Aug 2019 21:23:46 GMT
hanm commented on a change in pull request #1051: ZOOKEEPER-3503: Add server side large request
throttling
URL: https://github.com/apache/zookeeper/pull/1051#discussion_r314089685
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
 ##########
 @@ -1358,6 +1395,68 @@ static void setMaxBatchSize(int size) {
         maxBatchSize = size;
     }
 
+    public int getLargeRequestMaxBytes() {
+        return largeRequestMaxBytes;
+    }
+
+    public void setLargeRequestMaxBytes(int bytes) {
+        largeRequestMaxBytes = bytes;
+    }
+
+    public int getLargeRequestThreshold() {
+        return largeRequestThreshold;
+    }
+
+    public void setLargeRequestThreshold(int threshold) {
+        largeRequestThreshold = threshold;
+    }
+
+    public int getLargeRequestBytes() {
+        return currentLargeRequestBytes.get();
+    }
+
+    private boolean isLargeRequest(int length) {
+        // The large request limit is disabled when threshold is -1
+        if (largeRequestThreshold == -1) {
+            return false;
+        }
+        return length > largeRequestThreshold;
+    }
+
+    private boolean testRequestSize(int length, boolean increment) {
 
 Review comment:
   One nit - we could use void return type instead of boolean as these check function will
never return false. Though, current form is ok to me too.

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


With regards,
Apache Git Services

Mime
View raw message