kfaraz commented on code in PR #13197:
URL: https://github.com/apache/druid/pull/13197#discussion_r994080461


##########
server/src/main/java/org/apache/druid/server/coordinator/RandomBalancerStrategy.java:
##########
@@ -26,24 +26,20 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.NavigableSet;
-import java.util.concurrent.ThreadLocalRandom;
 import java.util.stream.Collectors;
 
 public class RandomBalancerStrategy implements BalancerStrategy
 {
   @Override
-  public ServerHolder findNewSegmentHomeReplicator(DataSegment 
proposalSegment, List<ServerHolder> serverHolders)
+  public Iterator<ServerHolder> findNewSegmentHomeReplicator(DataSegment 
proposalSegment, List<ServerHolder> serverHolders)

Review Comment:
   On second thought, I wonder if `Iterator` is actually better. A caller 
should always iterate over the eligible servers in order and we get the benefit 
of the simple `hasNext` and `next` methods, rather than having to use `isEmpty` 
and `get`.
   
   The one benefit I see with having a list is if we wanted to get the count of 
servers that were found to be eligible upfront (in case we wanted to report 
that).
   What do you advise?



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