From 1537bcf55a86cee4e062e62d4fe6545579cbca1e Mon Sep 17 00:00:00 2001 From: fjy Date: Wed, 22 May 2013 23:53:31 -0700 Subject: [PATCH] restore server selector behaviour --- .../com/metamx/druid/client/selector/ServerSelector.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); + } } } }