lucene-lucene-net-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r893339 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
Date Tue, 22 Dec 2009 23:09:33 GMT
Author: digy
Date: Tue Dec 22 23:09:32 2009
New Revision: 893339

URL: http://svn.apache.org/viewvc?rev=893339&view=rev
Log:
LUCENENET-326 Bug in TestSort.TestParallelMultiSort

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/SupportClass.cs?rev=893339&r1=893338&r2=893339&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Tue Dec 22 23:09:32 2009
@@ -1305,19 +1305,12 @@
         /// </summary>
         private void Clean()
         {
-            ArrayList keysToDelete = new ArrayList();
-            lock (this)
+            foreach (WeakKey wtk in ((Hashtable)base.Clone()).Keys)
             {
-                foreach (WeakKey wtk in base.Keys)
+                if (!wtk.IsAlive)
                 {
-                    if (!wtk.IsAlive)
-                    {
-                        keysToDelete.Add(wtk);
-                    }
-                }
-
-                foreach (WeakKey wtk in keysToDelete)
                     Remove(wtk);
+                }
             }
         }
 
@@ -1328,19 +1321,13 @@
         public override void Add(object key, object value)
         {
             CleanIfNeeded();
-            lock (this)
-            {
-                base.Add(new WeakKey(key), value);
-            }
+            base.Add(new WeakKey(key), value);
         }
 
         public override IDictionaryEnumerator GetEnumerator()
         {
             Hashtable tmp = null;
-            lock (this)
-            {
-                tmp = (Hashtable)base.Clone();
-            }
+            tmp = (Hashtable)base.Clone();
             return new WeakDictionaryEnumerator(tmp.GetEnumerator());
         }
 
@@ -1352,16 +1339,15 @@
             get
             {
                 ArrayList keys = new ArrayList(Count);
-                lock (this)
-                {
-
-                    foreach (WeakKey key in base.Keys)
-                    {
-                        object realKey = key.Target;
-                        if (realKey != null)
-                            keys.Add(realKey);
-                    }
+                Hashtable tmpTable = (Hashtable)base.Clone();
+                
+                foreach (WeakKey key in tmpTable.Keys)
+                {
+                    object realKey = key.Target;
+                    if (realKey != null)
+                        keys.Add(realKey);
                 }
+                
                 return keys;
             }
         }
@@ -1375,10 +1361,7 @@
             set
             {
                 CleanIfNeeded();
-                lock (this)
-                {
-                    base[new WeakKey(key)] = value;
-                }
+                base[new WeakKey(key)] = value;
             }
         }
 



Mime
View raw message