Skip to content

Commit

Permalink
issue-650 DynamicLoadBalancingPolicy: LatencyAwareHClientPool may thr…
Browse files Browse the repository at this point in the history
…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
jsbret committed Jan 16, 2014
1 parent d48e723 commit 07f271c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 07f271c

Please sign in to comment.