zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] jhuan31 commented on a change in pull request #986: ZOOKEEPER-3243: Add server-side request throttling
Date Mon, 01 Jul 2019 20:04:24 GMT
jhuan31 commented on a change in pull request #986: ZOOKEEPER-3243: Add server-side request
throttling
URL: https://github.com/apache/zookeeper/pull/986#discussion_r299196405
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
 ##########
 @@ -910,6 +957,36 @@ protected void setLocalSessionFlag(Request si) {
     }
 
     public void submitRequest(Request si) {
+        if (RequestThrottler.enabled()) {
+            enqueueRequest(si);
+        } else {
+            submitRequestNow(si);
+        }
+    }
+
+    public void enqueueRequest(Request si) {
+        if (requestThrottler == null) {
+            synchronized (this) {
+                try {
+                    // Since all requests are passed to the request
+                    // processor it should wait for setting up the request
+                    // processor chain. The state will be updated to RUNNING
+                    // after the setup.
+                    while (state == State.INITIAL) {
+                        wait(1000);
 
 Review comment:
   this is not invented in this patch :) it has been in the ZooKeeperServer to wait for the
request pipeline to start up. We just copy/paste 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


With regards,
Apache Git Services

Mime
View raw message