Netflix / ocelli

Apache License 2.0
53 stars 28 forks source link

The weights of ClientsAndWeights aren't guaranteed to be sorted for binary searching #70

Closed futurely closed 9 years ago

futurely commented 9 years ago

RandomWeightedLoadBalancer selects the client using Collections.binarySearch which requires the list to be sorted to avoid undefined results. There are no preconditions to check that the weights are actually sorted.

elandau commented 9 years ago

The list is assumed to be sorted. I'll add documentation to call that out but I don't see the value of doing an actual precondition check.