Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-776

Use WeakHashMap instead of Hashtable in FSDirectory

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I was just reading the FSDirectory java code, then I found this :

      /** 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...
        */
        private static final Hashtable DIRECTORIES = new Hashtable();

      Since Lucene is now requiring at least 1.2 (for ThreadLocal for instance, which is using BTW some WeakHashMap), maybe it is time to change ?

        Attachments

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              hibou Nicolas Lalevée
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: