Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

tweaks

Mark Robert Milleraa9b85c26058
diff --git a/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java b/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java
index 3655fdf8900..55af3e73b21 100644
--- a/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java
+++ b/solr/src/java/org/apache/solr/core/RefCntRamDirectory.java
@@ -7,37 +7,35 @@ import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
public class RefCntRamDirectory extends RAMDirectory {
-
+
private final AtomicInteger refCount = new AtomicInteger();
-
+
public RefCntRamDirectory() {
super();
- incRef();
+ refCount.set(1);
}
public RefCntRamDirectory(Directory dir) throws IOException {
this();
Directory.copy(dir, this, false);
}
-
+
public void incRef() {
ensureOpen();
refCount.incrementAndGet();
}
-
+
public void decRef() {
ensureOpen();
if (refCount.getAndDecrement() == 1) {
super.close();
}
}
-
+
public final synchronized void close() {
- if (isOpen) {
- decRef();
- }
+ decRef();
}
-
+
public boolean isOpen() {
return isOpen;
}