LUCENE-6076: Remove unnecessary copy (thanks Robert for pointing this out).

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1641824 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2014-11-26 14:34:50 +00:00
parent 86e6db22f7
commit a03adb85ea
1 changed files with 2 additions and 3 deletions

View File

@ -149,10 +149,9 @@ public class CachingWrapperFilter extends Filter implements Accountable {
@Override
public Iterable<? extends Accountable> getChildResources() {
// Sync to pull the current set of values:
final Map<Object, DocIdSet> copy;
synchronized (cache) {
copy = new HashMap<>(cache);
// no need to clone, Accountable#namedAccountables already copies the data
return Accountables.namedAccountables("segment", cache);
}
return Accountables.namedAccountables("segment", copy);
}
}