Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-776: just clarifying comment on the private DIRECTORIES cache in FSDirectory

Michael McCandlessff86319f0381
diff --git a/src/java/org/apache/lucene/store/FSDirectory.java b/src/java/org/apache/lucene/store/FSDirectory.java
index d27601d7cd3..dcb9bff8742 100644
--- a/src/java/org/apache/lucene/store/FSDirectory.java
+++ b/src/java/org/apache/lucene/store/FSDirectory.java
@@ -47,10 +47,11 @@ public class FSDirectory extends Directory {
/** This cache of directories ensures that there is a unique Directory
* instance per path, so that synchronization on the Directory can be used to
- * synchronize access between readers and writers.
- *
- * This should be a WeakHashMap, so that entries can be GC'd, but that would
- * require Java 1.2. Instead we use refcounts...
+ * synchronize access between readers and writers. We use
+ * refcounts to ensure when the last use of an FSDirectory
+ * instance for a given canonical path is closed, we remove the
+ * instance from the cache. See LUCENE-776
+ * for some relevant discussion.
*/
private static final Hashtable DIRECTORIES = new Hashtable();