incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject 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 Tue, 14 Jan 2014 11:06:46 GMT
Updated Branches:
  refs/heads/apache-blur-0.2 417f39251 -> ab41cc456


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/ab41cc45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/ab41cc45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/ab41cc45

Branch: refs/heads/apache-blur-0.2
Commit: ab41cc45679b2626164a8d37ecd1799997d8fb5a
Parents: 417f392
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Jan 14 06:06:43 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Jan 14 06:06:43 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/ab41cc45/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