Пример #1
0
        /// <summary>
        /// Prunes the blockedQueue by removing all DWPT that are associated with the given flush queue.
        /// </summary>
        private void PruneBlockedQueue(DocumentsWriterDeleteQueue flushingQueue)
        {
            var node = blockedFlushes.First;

            while (node != null)
            {
                var          nextNode     = node.Next;
                BlockedFlush blockedFlush = node.Value;
                if (blockedFlush.Dwpt.deleteQueue == flushingQueue)
                {
                    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;
            }
        }
 /// <summary>
 /// Prunes the blockedQueue by removing all DWPT that are associated with the given flush queue.
 /// </summary>
 private void PruneBlockedQueue(DocumentsWriterDeleteQueue flushingQueue)
 {
     lock (this)
     {
         IEnumerator <BlockedFlush> iterator = BlockedFlushes.GetEnumerator();
         while (iterator.MoveNext())
         {
             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);
             }
         }
     }
 }