You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2024/04/17 12:53:37 UTC

(hbase) branch branch-3 updated: HBASE-28500 Rest Java client library assumes stateless servers (Addendum:fix spotbugs warning) (#5831)

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

stoty pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 244b0c8e9b4 HBASE-28500 Rest Java client library assumes stateless servers (Addendum:fix spotbugs warning) (#5831)
244b0c8e9b4 is described below

commit 244b0c8e9b43dab93c98061b15146f33b4fa5c62
Author: Istvan Toth <st...@apache.org>
AuthorDate: Wed Apr 17 14:48:00 2024 +0200

    HBASE-28500 Rest Java client library assumes stateless servers (Addendum:fix spotbugs warning) (#5831)
---
 .../src/main/java/org/apache/hadoop/hbase/rest/client/Client.java      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
index 96cb5f290b0..abf00f938c9 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java
@@ -35,6 +35,7 @@ import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ThreadLocalRandom;
 import javax.net.ssl.SSLContext;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -270,7 +271,7 @@ public class Client {
       throw new IOException("Cluster is empty");
     }
     if (lastNodeId == null || !sticky) {
-      lastNodeId = (int) (cluster.nodes.size() * Math.random());
+      lastNodeId = ThreadLocalRandom.current().nextInt(cluster.nodes.size());
     }
     int start = lastNodeId;
     do {