lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: .NET doesn't support removing an iterm while iterating a collection
Date Wed, 04 Feb 2015 21:57:28 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master a4e60e32c -> 086ef2e02


.NET doesn't support removing an iterm while iterating a collection

Relates to #74


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/086ef2e0
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/086ef2e0
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/086ef2e0

Branch: refs/heads/master
Commit: 086ef2e020a9a72165fd5230fdfc13542b158f1b
Parents: a4e60e3
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Wed Feb 4 23:57:16 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Wed Feb 4 23:57:16 2015 +0200

----------------------------------------------------------------------
 .../Index/DocumentsWriterFlushControl.cs        | 26 +++++++++-----------
 1 file changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/086ef2e0/src/Lucene.Net.Core/Index/DocumentsWriterFlushControl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocumentsWriterFlushControl.cs b/src/Lucene.Net.Core/Index/DocumentsWriterFlushControl.cs
index dde10da..317903e 100644
--- a/src/Lucene.Net.Core/Index/DocumentsWriterFlushControl.cs
+++ b/src/Lucene.Net.Core/Index/DocumentsWriterFlushControl.cs
@@ -732,23 +732,21 @@ namespace Lucene.Net.Index
         /// </summary>
         private void PruneBlockedQueue(DocumentsWriterDeleteQueue flushingQueue)
         {
-            lock (this)
+            var node = BlockedFlushes.First;
+            while (node != null)
             {
-                IEnumerator<BlockedFlush> iterator = BlockedFlushes.GetEnumerator();
-                while (iterator.MoveNext())
+                var nextNode = node.Next;
+                BlockedFlush blockedFlush = node.Value;
+                if (blockedFlush.Dwpt.DeleteQueue == flushingQueue)
                 {
-                    BlockedFlush blockedFlush = iterator.Current;
-                    if (blockedFlush.Dwpt.DeleteQueue == flushingQueue)
-                    {
-                        //LUCENE TODO: Move to try finally
-                        BlockedFlushes.Remove(blockedFlush);
-                        Debug.Assert(!FlushingWriters.ContainsKey(blockedFlush.Dwpt), "DWPT
is already flushing");
-                        // Record the flushing DWPT to reduce flushBytes in doAfterFlush
-                        FlushingWriters[blockedFlush.Dwpt] = Convert.ToInt64(blockedFlush.Bytes);
-                        // don't decr pending here - its already done when DWPT is blocked
-                        FlushQueue.Enqueue(blockedFlush.Dwpt);
-                    }
+                    BlockedFlushes.Remove(node);
+                    Debug.Assert(!FlushingWriters.ContainsKey(blockedFlush.Dwpt), "DWPT is
already flushing");
+                    // Record the flushing DWPT to reduce flushBytes in doAfterFlush
+                    FlushingWriters[blockedFlush.Dwpt] = Convert.ToInt64(blockedFlush.Bytes);
+                    // don't decr pending here - its already done when DWPT is blocked
+                    FlushQueue.Enqueue(blockedFlush.Dwpt);
                 }
+                node = nextNode;
             }
         }
 


Mime
View raw message