diff --git a/client/src/main/java/com/metamx/druid/client/selector/ServerSelector.java b/client/src/main/java/com/metamx/druid/client/selector/ServerSelector.java index 086b117b59a..388761aaaa2 100644 --- a/client/src/main/java/com/metamx/druid/client/selector/ServerSelector.java +++ b/client/src/main/java/com/metamx/druid/client/selector/ServerSelector.java @@ -83,7 +83,12 @@ public class ServerSelector public QueryableDruidServer pick() { synchronized (this) { - return Collections.min(servers, comparator); + final int size = servers.size(); + switch (size) { + case 0: return null; + case 1: return servers.iterator().next(); + default: return Collections.min(servers, comparator); + } } } }