incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [13/28] git commit: Making sure that the ref count can only be decremented once when the searcher is closing. This may have been causing some weird already closed exceptions.
Date Wed, 15 Jan 2014 22:03:36 GMT
Making sure that the ref count can only be decremented once when the searcher is closing. 
This may have been causing some weird already closed exceptions.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/d084a16b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/d084a16b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/d084a16b

Branch: refs/heads/master
Commit: d084a16b0fb908dbe9c396a58f199109efb43f45
Parents: ae31413
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Jan 14 06:06:43 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Jan 15 17:02:31 2014 -0500

----------------------------------------------------------------------
 .../blur/manager/writer/BlurIndexSimpleWriter.java      | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d084a16b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
index 296cb6e..0427195 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java
@@ -152,14 +152,22 @@ public class BlurIndexSimpleWriter extends BlurIndex {
     final IndexReader indexReader = _indexReader.get();
     indexReader.incRef();
     return new IndexSearcherClosable(indexReader, _searchThreadPool) {
+
+      private boolean _closed;
+
       @Override
       public Directory getDirectory() {
         return _directory;
       }
 
       @Override
-      public void close() throws IOException {
-        indexReader.decRef();
+      public synchronized void close() throws IOException {
+        if (!_closed) {
+          indexReader.decRef();
+          _closed = true;
+        } else {
+          LOG.error("Searcher already closed [{0}].", new Throwable(), this);
+        }
       }
     };
   }


Mime
View raw message