Github user synhershko commented on a diff in the pull request:

    https://github.com/apache/lucenenet/pull/171#discussion_r62423483
  
    --- Diff: src/Lucene.Net.Core/Index/TaskMergeScheduler.cs ---
    @@ -0,0 +1,665 @@
    +using System;
    +using System.Collections.Generic;
    +using System.Text;
    +using System.Threading;
    +
    +namespace Lucene.Net.Index
    +{
    +    using Lucene.Net.Support;
    +    using System.Linq;
    +    using System.Threading.Tasks;
    +    using Util;
    +
    +    /*
    +         * Licensed to the Apache Software Foundation (ASF) under one or 
more
    +         * contributor license agreements.  See the NOTICE file 
distributed with
    +         * this work for additional information regarding copyright 
ownership.
    +         * The ASF licenses this file to You under the Apache License, 
Version 2.0
    +         * (the "License"); you may not use this file except in compliance 
with
    +         * the License.  You may obtain a copy of the License at
    +         *
    +         *     http://www.apache.org/licenses/LICENSE-2.0
    +         *
    +         * Unless required by applicable law or agreed to in writing, 
software
    +         * distributed under the License is distributed on an "AS IS" 
BASIS,
    +         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.
    +         * See the License for the specific language governing permissions 
and
    +         * limitations under the License.
    +         */
    +
    +    using Directory = Lucene.Net.Store.Directory;
    +
    +    /// <summary>
    +    ///  A <seealso cref="MergeScheduler"/> that runs each merge using
    +    ///  Tasks on the default TaskScheduler.
    +    /// 
    +    ///  <p>If more than <seealso cref="#GetMaxMergeCount"/> merges are
    +    ///  requested then this class will forcefully throttle the
    +    ///  incoming threads by pausing until one more more merges
    +    ///  complete.</p>
    +    /// </summary>
    +    public class TaskMergeScheduler : MergeScheduler, 
IConcurrentMergeScheduler
    +    {
    +        public const string COMPONENT_NAME = "CMS";
    +
    +        private readonly TaskScheduler _taskScheduler = 
TaskScheduler.Default;
    +        private readonly ReaderWriterLockSlim _lock = new 
ReaderWriterLockSlim();
    +        private readonly ManualResetEventSlim _manualResetEvent = new 
ManualResetEventSlim();
    +        /// <summary>
    +        /// List of currently active <seealso 
cref="MergeThread"/>s.</summary>
    +        private readonly IList<MergeThread> _mergeThreads = new 
List<MergeThread>();
    --- End diff --
    
    Will initializing the list size to _taskScheduler.MaximumConcurrencyLevel 
help with performance in any way?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to