You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/01/06 17:37:28 UTC

[GitHub] [zookeeper] jhuan31 commented on a change in pull request #1199: ZOOKEEPER-3671: Use ThreadLocalConcurrent to Replace Random and Math.…

jhuan31 commented on a change in pull request #1199: ZOOKEEPER-3671: Use ThreadLocalConcurrent to Replace Random and Math.…
URL: https://github.com/apache/zookeeper/pull/1199#discussion_r363400104
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/watch/WatcherCleaner.java
 ##########
 @@ -133,7 +132,7 @@ public void run() {
                     // same time in the quorum
                     if (!stopped && deadWatchers.size() < watcherCleanThreshold) {
                         int maxWaitMs = (watcherCleanIntervalInSeconds
-                                         + r.nextInt(watcherCleanIntervalInSeconds / 2 + 1)) * 1000;
+                                         + ThreadLocalRandom.current().nextInt(watcherCleanIntervalInSeconds / 2 + 1)) * 1000;
 
 Review comment:
   Hi @belugabehr, I wrote BlueThrottleTest and it didn't use seed. It overwrites the nextDouble() function of Random so it returns a non-random number for the test to get repeatable results. We probably can do the same for ThreadLocalRandom so it can be used? 

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