mirror of https://github.com/apache/lucene.git
LUCENE-2831: use int[] instead of AtomicInteger
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1055638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
36b17aab62
commit
9557559df0
|
@ -19,7 +19,6 @@ package org.apache.lucene.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
|
@ -197,19 +196,19 @@ public final class ReaderUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int numLeaves(IndexReader reader) {
|
private int numLeaves(IndexReader reader) {
|
||||||
final AtomicInteger numLeaves = new AtomicInteger();
|
final int[] numLeaves = new int[1];
|
||||||
try {
|
try {
|
||||||
new Gather(reader) {
|
new Gather(reader) {
|
||||||
@Override
|
@Override
|
||||||
protected void add(int base, IndexReader r) {
|
protected void add(int base, IndexReader r) {
|
||||||
numLeaves.incrementAndGet();
|
numLeaves[0]++;
|
||||||
}
|
}
|
||||||
}.run();
|
}.run();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
// won't happen
|
// won't happen
|
||||||
throw new RuntimeException(ioe);
|
throw new RuntimeException(ioe);
|
||||||
}
|
}
|
||||||
return numLeaves.get();
|
return numLeaves[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue