diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/att/nsa/mr/client/HostSelector.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/com/att/nsa/mr/client/HostSelector.java b/src/main/java/com/att/nsa/mr/client/HostSelector.java index 5a77244..4174cbc 100644 --- a/src/main/java/com/att/nsa/mr/client/HostSelector.java +++ b/src/main/java/com/att/nsa/mr/client/HostSelector.java @@ -66,16 +66,17 @@ public class HostSelector if (signature == null) { return; } - if(signature!=null && !baseHosts.isEmpty()) { - int index = Math.abs(signature.hashCode()) % baseHosts.size(); - + int index = 0 ; + int value = signature.hashCode(); + if(value!=0) { + index = Math.abs(value) % baseHosts.size(); + } Iterator it = this.fBaseHosts.iterator(); while (index-- > 0) { it.next(); } this.fIdealHost = ((String)it.next()); - } } public String selectBaseHost() |