lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject svn commit: r1213033 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java
Date Sun, 11 Dec 2011 17:52:53 GMT
Author: shaie
Date: Sun Dec 11 17:52:52 2011
New Revision: 1213033

URL: http://svn.apache.org/viewvc?rev=1213033&view=rev
Log:
LUCENE-3637: change IndexReader.decRef to call decrementAndGet

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1213033&r1=1213032&r2=1213033&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexReader.java Sun Dec 11 17:52:52
2011
@@ -257,8 +257,8 @@ public abstract class IndexReader implem
    */
   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 implem
         }
       }
       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");
     }
   }
   



Mime
View raw message