Skip to content

Commit

Permalink
defensively handle dup keys in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
yonik committed Mar 10, 2014
1 parent 67cfdc0 commit 05f6c83
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,11 @@ public Map<K,V> getLatestAccessedItems(int n) {
markAndSweepLock.unlock();
}
for (CacheEntry<K,V> e : tree) {
result.put(e.key, e.value);
V prev = result.put(e.key, e.value);
if (prev instanceof RefCount) {
// Can be hit with ant test -Dtest=TestFiltering -Dtests.seed=5112224A7DAF7DD46
((RefCount)prev).decref();
}
}
return result;
}
Expand Down

0 comments on commit 05f6c83

Please sign in to comment.