lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eladmarg <...@git.apache.org>
Subject [GitHub] lucenenet pull request #188: Fixed 64 Failing Facet Tests and Finished Facet...
Date Wed, 28 Sep 2016 21:53:50 GMT
Github user eladmarg commented on a diff in the pull request:

    https://github.com/apache/lucenenet/pull/188#discussion_r81025984
  
    --- Diff: src/Lucene.Net.Facet/Taxonomy/LRUHashMap.cs ---
    @@ -100,19 +120,25 @@ public bool Put(TKey key, TValue value)
                             timestamp = GetTimestamp()
                         };
                         // We have added a new item, so we may need to remove the eldest
    -                    if (cache.Count > Capacity)
    +                    if (cache.Count > capacity)
                         {
                             // Remove the eldest item (lowest timestamp) from the cache
                             cache.Remove(cache.OrderBy(x => x.Value.timestamp).First().Key);
                         }
                     }
    +
    +                return true;
    +            }
    +            finally
    +            {
    +                syncLock.ExitWriteLock();
                 }
    -            return true;
             }
     
             public TValue Get(TKey key)
             {
    -            lock (syncLock)
    +            syncLock.EnterWriteLock();
    --- End diff --
    
    I can confirm that after replacing to ConcurrentDictionary implementation, same all tests
pass.
    (Except TestLRUHashMap, but we can ignore it)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message