mirror of
https://github.com/apache/lucene.git
synced 2025-03-09 01:59:27 +00:00
LUCENE-3637: change IndexReader.decRef to call decrementAndGet
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1213033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
503097ac71
commit
9e193b62bc
@ -257,8 +257,8 @@ public abstract class IndexReader implements Cloneable,Closeable {
|
||||
*/
|
||||
public final void decRef() throws IOException {
|
||||
ensureOpen();
|
||||
final int rc = refCount.getAndDecrement();
|
||||
if (rc == 1) {
|
||||
final int rc = refCount.decrementAndGet();
|
||||
if (rc == 0) {
|
||||
boolean success = false;
|
||||
try {
|
||||
doClose();
|
||||
@ -270,8 +270,8 @@ public abstract class IndexReader implements Cloneable,Closeable {
|
||||
}
|
||||
}
|
||||
readerFinished();
|
||||
} else if (rc <= 0) {
|
||||
throw new IllegalStateException("too many decRef calls: refCount was " + rc + " before decrement");
|
||||
} else if (rc < 0) {
|
||||
throw new IllegalStateException("too many decRef calls: refCount is " + rc + " after decrement");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user