clintropolis commented on code in PR #14985:
URL: https://github.com/apache/druid/pull/14985#discussion_r1378764455
##########
server/src/main/java/org/apache/druid/client/SegmentLoadInfo.java:
##########
@@ -59,6 +61,15 @@ public ImmutableSegmentLoadInfo toImmutableSegmentLoadInfo()
return new ImmutableSegmentLoadInfo(segment, servers);
}
+ /**
+ * Randomly return one server from the sets of {@code servers}
+ */
+ public DruidServerMetadata pickOne()
+ {
+ synchronized (this) {
Review Comment:
yea, something similar to what @cryptoe suggests; `Iterators.get` is just
taking the iterator returned by the collection and calling hasNext to navigate
to a specific index, so we could just return the last element available if the
index we picked is no longer present (though a while loop might be a bit
cleaner)
--
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]