hanm commented on a change in pull request #1051: Add server side large request
throttling
URL: https://github.com/apache/zookeeper/pull/1051#discussion_r313145645
##########
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:
having a boolean parameter in a function seems an anti pattern to me.
Is there a case when we don't want increment?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services