wary commented on code in PR #329:
URL: 
https://github.com/apache/doris-spark-connector/pull/329#discussion_r2188911692


##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/util/LoadBalanceList.java:
##########
@@ -0,0 +1,38 @@
+package org.apache.doris.spark.util;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+
+public class LoadBalanceList<T> implements Iterable<T> {
+
+       private final List<T> list;
+
+       public LoadBalanceList(List<T> servers) {
+               this.list = Collections.unmodifiableList(servers);
+       }
+
+       @Override
+       public Iterator<T> iterator() {
+               return new Iterator<T>() {
+                       final int offset = Math.abs(new Random().nextInt());

Review Comment:
   The iterator is re-initialized each time it is traversed, the offset will 
also have different value



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to