incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixed BLUR-249
Date Mon, 30 Sep 2013 21:59:07 GMT
Updated Branches:
  refs/heads/master 42606847f -> bbaf016bf


Fixed BLUR-249


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

Branch: refs/heads/master
Commit: bbaf016bfbb2296e4d2787e44340a62ffdbae153
Parents: 4260684
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Sep 30 17:58:15 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Sep 30 17:59:04 2013 -0400

----------------------------------------------------------------------
 .../lucene/store/refcounter/IndexInputCloser.java     | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/bbaf016b/blur-store/src/main/java/org/apache/blur/lucene/store/refcounter/IndexInputCloser.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/lucene/store/refcounter/IndexInputCloser.java
b/blur-store/src/main/java/org/apache/blur/lucene/store/refcounter/IndexInputCloser.java
index 49b7424..2683f3c 100644
--- a/blur-store/src/main/java/org/apache/blur/lucene/store/refcounter/IndexInputCloser.java
+++ b/blur-store/src/main/java/org/apache/blur/lucene/store/refcounter/IndexInputCloser.java
@@ -21,7 +21,8 @@ import java.io.IOException;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.Collection;
-import java.util.HashSet;
+import java.util.Collections;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.blur.log.Log;
@@ -36,7 +37,8 @@ public class IndexInputCloser implements Runnable, Closeable {
   private ReferenceQueue<IndexInput> referenceQueue = new ReferenceQueue<IndexInput>();
   private Thread daemon;
   private AtomicBoolean running = new AtomicBoolean();
-  private Collection<IndexInputCloserRef> refs = new HashSet<IndexInputCloserRef>();
+  private Collection<IndexInputCloserRef> refs = Collections
+      .newSetFromMap(new ConcurrentHashMap<IndexInputCloserRef, Boolean>());
 
   static class IndexInputCloserRef extends WeakReference<IndexInput> implements Closeable
{
     public IndexInputCloserRef(IndexInput referent, ReferenceQueue<? super IndexInput>
q) {
@@ -64,9 +66,7 @@ public class IndexInputCloser implements Runnable, Closeable {
   public void add(IndexInput indexInput) {
     LOG.debug("Adding [{0}]", indexInput);
     IndexInputCloserRef ref = new IndexInputCloserRef(indexInput, referenceQueue);
-    synchronized (refs) {
-      refs.add(ref);
-    }
+    refs.add(ref);
   }
 
   public void close() {
@@ -82,9 +82,7 @@ public class IndexInputCloser implements Runnable, Closeable {
         IndexInputCloserRef ref = (IndexInputCloserRef) referenceQueue.remove();
         LOG.debug("Closing [{0}]", ref);
         IOUtils.closeWhileHandlingException(ref);
-        synchronized (refs) {
-          refs.remove(ref);
-        }
+        refs.remove(ref);
       } catch (InterruptedException e) {
         LOG.debug("Interrupted");
         running.set(false);


Mime
View raw message