You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2024/08/21 19:16:30 UTC

(pinot) branch master updated: use ThreadLocalRandom in RoundRobinURIProvider (#13858)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 579fa8ef16 use ThreadLocalRandom in RoundRobinURIProvider (#13858)
579fa8ef16 is described below

commit 579fa8ef16a898559312f04b21cd7b2b682bec4b
Author: sullis <gi...@seansullivan.com>
AuthorDate: Wed Aug 21 12:16:24 2024 -0700

    use ThreadLocalRandom in RoundRobinURIProvider (#13858)
---
 .../java/org/apache/pinot/common/utils/RoundRobinURIProvider.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java
index 211e7a60ee..52ea8843bc 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/RoundRobinURIProvider.java
@@ -25,7 +25,7 @@ import java.net.URISyntaxException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.hc.core5.net.URIBuilder;
 
 
@@ -46,7 +46,7 @@ public class RoundRobinURIProvider {
     } else {
       _uris = List.copyOf(originalUris);
     }
-    _index = new Random().nextInt(_uris.size());
+    _index = ThreadLocalRandom.current().nextInt(_uris.size());
   }
 
   public int numAddresses() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org