Esempio n. 1
0
        public ThreadedIndexWriter(Directory dir, Analyzer a, bool create, int numThreads, int maxQueueSize, IndexWriter.MaxFieldLength mfl)
            : base(dir, a, create, mfl)
        {
            defaultAnalyzer = a;

            threadPool = new ThreadPoolWithBlockingQueue(numThreads, maxQueueSize);
        }
Esempio n. 2
0
        public ThreadedIndexWriter(Directory dir, Analyzer a, bool create, IndexWriter.MaxFieldLength mfl)
            : base(dir, a, create, mfl)
        {
            defaultAnalyzer = a;

            int numThreads = 1;

            // 2 of 3 processors?
            if (Environment.ProcessorCount > 1 && Environment.ProcessorCount < 4)
            {
                // Special case
                numThreads = 2;
            }
            else if (Environment.ProcessorCount >= 4)
            {
                numThreads = Environment.ProcessorCount - 1;
            }
            int maxQueueSize = (numThreads * 2) + 2000;

            threadPool = new ThreadPoolWithBlockingQueue(numThreads, maxQueueSize);
        }