zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] enixon commented on a change in pull request #876: ZOOKEEPER-3020: Review of SyncRequestProcessor
Date Mon, 08 Apr 2019 23:57:14 GMT
enixon commented on a change in pull request #876: ZOOKEEPER-3020: Review of SyncRequestProcessor
URL: https://github.com/apache/zookeeper/pull/876#discussion_r273281479
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/SyncRequestProcessor.java
 ##########
 @@ -102,103 +108,96 @@ public void run() {
 
             // we do this in an attempt to ensure that not all of the servers
             // in the ensemble take a snapshot at the same time
-            int randRoll = r.nextInt(snapCount/2);
+            int randRoll = ThreadLocalRandom.current().nextInt(snapCount / 2, snapCount);
             while (true) {
-                Request si = null;
-                if (toFlush.isEmpty()) {
+                Request si = queuedRequests.poll();
 
 Review comment:
   Is behavior changing here? Your logic of tolling from a `poll` directly to a `take` instead
of forcing a loop via `continue` looks right to me - is there a way that `take` can respond
with a null value or otherwise break something in the new arrangement?

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