Permalink
Browse files

issue-650 DynamicLoadBalancingPolicy: LatencyAwareHClientPool may thr…

…ow NoSuchElementException under certain circumstances

Using the poll() method of the LinkedBlockingDeque prevent
NoSuchElementException throwing in case the deque is cleared by the
DynamicLoadBalancingPolicy resetThread.
  • Loading branch information...
1 parent d48e723 commit 07f271c555a243a551af53e0392295058cc9d627 jsbret committed Jan 16, 2014
@@ -45,7 +45,7 @@ void add(double i) {
if (intervalupdates.intValue() >= UPDATES_PER_INTERVAL)
return;
if (!latencies.offer(i)) {
- latencies.remove();
+ latencies.poll();
latencies.offer(i);
}
intervalupdates.getAndIncrement();

0 comments on commit 07f271c

Please sign in to comment.